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
Packaging Features
Orders
Custom Fields for Orders
Reference Numbers
Shipping Accounts
Packing Instructions
External Shipping Methods
Tracking Numbers for Offline Shipments
Other Shipping Options
Packing Slip Design
Service Levels and Target Ship Dates
Outbound SSCC Barcodes
International Shipping
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
User Management
Warehouses
User Roles
Merchants and Brands
Third Party Billing
Login via Badge
Manifest Couriers
Integrations
Plugin Subscriptions
Merchant API Users and Roles
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 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
Table of Contents
- All Categories
- Scripting
- Before Create Order Scripts
Before Create Order Scripts
Updated
by Cory M.
The "Before Create Order" script type executes just before an order is created. This script allows you to transform the order options, address, and items or reject the order entirely.
See "Scripting Basics" to become more familiar with scripting in ShipStream in general.
How to Create a Before Create Order Script
- Navigate to System > Scripts.
- Click Create New Script at the top right.
- Select the Merchant to which the script will be applicable or "--All Merchants--" to have the script apply to all merchants.
- Enter a brief description for the script so you can easily identify it. This description will also appear in the order's History tab if the script has an error or prints any output.
- Select Before Create Order as the Type.
- Change the Is Active field to Yes if you wish to use the script after it is saved, or leave it as No to disable it for now.
- Set a Sort Order if using multiple scripts to control the order in which the scripts are applied. Lower numbers will run before script with higher numbers.
- Click Save.
Debugging
If the script contains a print()
statement, then the Order History tab will display the script ID that applied to the order next to the Order Status. In the example below, the print statement print("Shipping Method Updated");
was added to the script and appears below the Description.

Clicking the script ID next to the status will re-direct users to that script in the editor.
Runtime Errors
If any errors occur during the execution of the script and are not captured and handled within the script they will cause the order submission to fail with an error describing the script which threw the error, the line number and the error message. These will be logged and visible at the bottom of the Edit Script page. Once the script is saved these errors will be cleared so that you can easily determine if new errors are still occurring.
The editor is able to detect basic syntactical errors, but it is still possible to introduce runtime errors. For example, a common issue is setting or referencing a property of an "undefined" expression:

