Ready to Ship Time Scripts

Colin 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 information
  • ShipStream - provides methods for creating new timestamp objects

Other methods available are:

  • print - add a message to the order history

order object

Here is an example of the order object expressed in JSON format.

let order = {
"merchant": "acme",
"store": "acme",
"sku": "73-323-6248",
"qty": null,
"unit_declared_value": null,
"unit_customs_value": null,
"sku": "73-323-6248",
"name": "ThinkPad X1 Yoga 1st Generation, Intel Core i5-6200U",
"barcode": "029465090326",
"external_id": null,
"vendor_sku": null,
"goods_type": "ORM_D",
"regulation_id": null,
"status": "1",
"availability": "1",
"visibility": "2",
"weight": 7.248,
"length": null,
"width": null,
"height": null,
"export_description": null,
"country_of_manufacture": null,
"customs_value_usd": null,
"customs_value": null,
"customs_value_currency": "USD",
"hts_base_code": null,
"hts_country_code": null,
"requires_packaging": 0,
"requires_infill": null,
"require_weight_check": 0,
"confirmation_per_item": 0,
"unit_qty": 1,
"bulk_qty": null,
"max_per_package": null,
"is_ship_separate": 0,
"ship_separate_tag": null,
"can_tip": 1,
"can_contain_other_items": 0,
"freight_class": null,
"freight_category": null,
"weight_lb": 7.248,
"weight_oz": 115.968,
"weight_kg": 3.2876375,
"weight_g": 3287.637500,
"length_in": null,
"length_cm": null,
"length_mm": null,
"width_in": null,
"width_cm": null,
"width_mm": null,
"height_in": null,
"height_cm": null,
"height_mm": null
"region_id": "56",
"region": "Tennessee",
"postcode": "37919",
"street": "123 Big Walk Way",
"city": "Knoxville",
"country_id": "US",
"company": "ACME Inc",
"classification": "com",
"is_valid": null
"signature_required": "none",
"saturday_delivery": "0",
"overbox": "0",
"requested_ship_date": null,
"desired_delivery_date": null,
"declared_value_service": "0",
"declared_value": null,
"customs_value": null,
"reason_for_export": null,
"priority": "50",
"backorder_policy": "default",
"tpb_group_id": null,
"shipping_method": "ups_03",
"order_ref": null,
"unique_id": "100000316",
"note": null,
"custom_greeting": null,
"date": "2023-09-07 14:48:01.000000",
"timezone_type": 3,
"timezone": "America/New_York"
"submitted_by": "api",
"old_status": "backordered"

ShipStream object

This object provides the following methods which may be used to obtain and manipulate timestamps. It is recommended to not use Javascript's built-in Date functions. dateTime, string timeZone)

Returns a PHP DateTime object initialized with the given string representing a date and time (supporting all of PHP's date and time formats) and time zone name (supporting all of PHP's standard timezones).

Example 1

return'tomorrow', 'America/New_York')

Example 2

if ('now', 'America/New_York').format('G') > 20) {
return'tomorrow', 'America/New_York')

Returns a PHP DateTime object initialized with the current time in the UTC timezone.


return'+2 hours')

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.


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'tomorrow', 'America/New_York')
} else if (order.old_status === 'backordered') {
return'+2 hours')
} else {

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'-3 hours')

How did we do?

Preprocess Packing Solution Scripts

Picking Class Shipment Matching Scripts