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
- Scripting Basics
Scripting Basics
Updated
by Cory M.
ShipStream utilizes an embedded JavaScript interpreter in many places to allow the user to define advanced business logic and customizations. The interpreter is an implementation of the 6th edition of ECMAScript known commonly as ES6 or ES2015.
Javascript Editor
On pages where a user may define a script the script is submitted in a text field that has some basic syntax highlighting and validation features.
Syntax Errors
If the script contains syntactical errors code then an indicator will appear on the line number where the error is detected. Hover your cursor over the icon to see more information. All errors and warnings must be addressed before the script can be saved.

Logical Errors
The built-in editor can detect many potential problems which are not syntactical. It is recommended not to ignore these warnings as they very likely are an indicator that the script will throw a logical error or not behave as expected.

Debugging
All scripts support a print()
function. This can take any arguments of any type and will cause the interpreter to "output" some information. This information will typically be captured by ShipStream and reported in an order's history or some other location relevant to the scope of the script. In general, use the print statement to provide the end users with useful information about what affect your script had or to debug your scripts.
if (order.address.country != 'MX') {
order.options.shipping_method = 'fedex_INTERNATIONAL_ECONOMY'
print('Forced order to Mexico to be shipped via FedEx International Economy')
}