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
- 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.
See the more detailed guides for additional information about writing specific types of scripts:
- Before Create Order Scripts
- Preprocess Packing Solution Scripts
- Ready to Ship Time Scripts
- Picking Class Shipment Matching Scripts
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')
}