Getting Started
Interface Basics
Shipping
Order Processing
Packaging Features
Orders
Order Allocation
Reference Numbers
Export Batch Orders
Packing Instructions
External Shipping Methods
Order Processing Loop
Packing Solutions
Add Tracking Numbers from Scanner
Picking Classes
Backorders
Brand Specific Shipping Account
Other Shipping Options
Packing Slip Design
Ready to Ship
Service Levels and Target Ship Dates
FedEx Production Key Certification
Outbound SSCC Barcodes
International Shipping
Manifest Couriers
Receiving
Deliveries (ASNs, RMAs, etc.)
Double-Scan to Begin Count
Auto-Advance to Put-Away After Processing ASN
Actionable Reports
Catalog
Operations
Warehouse
Picking Batches
Manifests (Loading)
License Plates
Time Tracking for Administrators
Time Tracking for Staff
Relocations
Import Locations, Lots and Inventory
Rating
System
Configuration
User Management
Warehouses
User Roles
Merchants and Brands
Shipping Accounts
Third Party Billing
Login via Badge
Printers and Scales
Trouble Shooting Printer and Scale Server
Troubleshooting the Print and Scale Server
Changing the Print and Scale Services' User
Getting the Local Windows User's Name
Zebra Printer Margin Troubleshooting
Printer Checklist
Installing the Printer and Scale Client
Scale Setup
Printer Setup
Printer - Additional Arguments
Integrations
Shopify
ShipStream Plugin Fostering Program
EasyPost
Amazon Merchant Fulfillment
API Users and Roles
External Shipping Method API
CartRover Integration
Magento 1 / OpenMage
FAQ
Scripting
Scripting Basics
Before Create Order Scripts
Preprocess Packing Solution Scripts
Ready to Ship Time Scripts
Picking Class Shipment Matching Scripts
ShipStream Flow
Release Notes
- 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')
}