Getting Started
Interface Basics
Printers and Scales
Device Hub
Device Hub Overview
Install the Device App
Install the Device Service
Adding Printer and Scale Devices
Legacy Client Migration Guide
Device Barcodes
Legacy Device Management
Printer Checklist
Installing the Printer and Scale Client
Scale Setup
Printer Setup
Printer - Additional Arguments
Troubleshooting the Print and Scale Server
Getting the Local Windows User's Name
Troubleshooting
Shipping
Order Processing
Order Allocation
Order Processing Loop
Packing Solutions
Backorders
Ready to Ship
"Unable to Process" Order status
Address Validation and Classification
Packaging Features
Orders
Custom Fields for Orders
Reference Numbers
Other Shipping Options
Packing Instructions
Shipping Accounts
External Shipping Methods
Third Party Billing
Manifest Couriers
Packing Slip Design
Service Levels and Target Ship Dates
Outbound SSCC Barcodes
International Shipping
Tracking Numbers for Offline Shipments
Receiving
Deliveries (ASNs, RMAs, etc.)
Double-Scan to Begin Count
Auto-Advance to Put-Away After Processing ASN
Actionable Reports
Catalog
Bill of Materials/Work Orders
Bill of Materials
Bill of Materials — Quantity-types
Work Orders
Import Bill of Materials
Virtual Inventory
Regulations
Products
Lots/Expirations Tracking
Import Products
Operations
Warehouse
Picking Classes
Picking Batches
Bulk Fulfill Orders
Manifests (Loading)
License Plates
Time Tracking for Administrators
Time Tracking for Staff
Relocations
Import Locations, Lots and Inventory
Rating
System
Configuration
Merchants and Brands
Warehouses
User Management
User Roles
User Groups
Login via Badge
Integrations
Plugin Subscriptions
Merchant API Users and Roles
Webhooks
External Shipping Method API
ShipStream Plugin Fostering Program
EasyPost
Amazon Selling Partner
Amazon Merchant Fulfillment
CartRover
Freight Club
SPS Commerce
Scripting
Scripting Basics
Before Create Order Scripts
Preprocess Packing Solution Scripts
Ready to Ship Time Scripts
Picking Class Shipment Matching Scripts
FAQ
How-To: FedEx Production Key Certification
How-To: Brand-Specific Shipping Account
Pattern and Replacement RegEx
ShipStream's Subprocessors
ISO Alpha-2 Country Codes
ShipStream Flow
Release Notes
ShipStream Releases
Version 2023.0
Package Tracking API Migration Guide (2023.0)
Version 2022.2
Version 2022.1
Version 2022.0
Version 2021.6
Version 2021.5
Version 2021.4
Version 2021.3
Version 2021.2
Version 2021.1
Version 2021.0
Version 2020.2
Version 2020.1
Version 2020.0
Version 2019.9
Version 2019.8.1
Version 2019.8
Version 2019.7
Version 2019.6
Version 2019.5
- All Categories
- Scripting
- Ready to Ship Time Scripts
Ready to Ship Time Scripts
Updated
by Colin
This script type is executed when an Order is created and when an Order changes from not-"Ready to Ship" to "Ready to Ship". The script may not modify any Order attributes, it can only return a timestamp object that will be used in place of the default current timestamp. If no value is returned the current timestamp is assumed.
The variables defined in the context of these scripts are:
order
- provides all of the order informationShipStream
- provides methods for creating new timestamp objects
Other methods available are:
print
- add a message to the order history
Script Priority
If there are multiple Ready to Ship Time scripts defined for the same Merchant, the first one to return a valid timestamp will be used and further scripts will not be executed. Use the Sort Order to ensure that the most important scripts are run first and do not return a value if you want to allow later scripts to run.
Example
This script causes the Ready To Ship time for "crossdock" orders to always be the next day, or for orders that were previously backordered to be delayed by two hours, and otherwise uses the default behavior.
if (order.options.shipping_method === 'external_crossdock') {
return ShipStream.date('tomorrow', 'America/New_York')
} else if (order.old_status === 'backordered') {
return ShipStream.now().modify('+2 hours')
} else {
return ShipStream.now()
}
Here is an example where the Ready to Ship time is set as 3 hours earlier than the actual time to help ensure they are fulfilled the same day.
if ((order.options.order_ref||'').match(/-VIP$/)) {
print('VIP order given 3 hours grace period for cut-off.')
return ShipStream.now().modify('-3 hours')
}