ShipStream Knowledge Base
Scripting

Packing Start Scripts

A Packing Start Script runs every time a packer opens a Shipment for packing in the Scanner. It can read details about the Shipment and adjust a handful of packing behaviors — most commonly the Weight Check tolerance band — for that specific Shipment, on top of whatever the Packing (Parcel) / Packing (Freight) configuration sections already provide.

See Scripting Basics to become more familiar with scripting in ShipStream in general.

Where It Lives

Packing Start Scripts are configured at System -> Configuration -> Warehouse -> Scanner -> Packing (General) -> Packing Start Script. Like Scale Precision, this setting applies per warehouse (Stock), not per Shipment Type — a single script runs for every Shipment packed at that warehouse, and can branch on the Shipment's own shipment_type if it needs to behave differently for Parcel vs. Freight.

Script Data

shipment (read-only)

FieldDescription
shipment_idThe Shipment's entity ID
external_idExternal ID, if any
order_unique_idThe Order's increment ID
order_refThe Order's external reference
carrier_codeCarrier code for the Shipment's shipping method
shipping_methodThe Shipment's shipping method code
batch_tagBatch tag from the Order
automation_dataAutomation data from the Order
merchantWebsite code
brandStore code
is_internationalWhether the Shipment is international
is_documents_requiredWhether customs/other documents are required
stock_idWarehouse (Stock) ID
picking_class_idPicking Class ID
shipment_typeparcel or freight
shipment_weight, order_weightTotal weight of the Shipment / Order

shipment_weight and order_weight also carry unit-suffixed variants for every supported weight unit — _lb, _oz, _g, and _kg (e.g. shipment_weight_lb, shipment_weight_kg) — use whichever unit suffix matches your logic instead of assuming the base unit.

config (readable)

FieldDescription
create_shipping_labelWhether a shipping label will be created automatically
create_shipping_label_offlineWhether the Shipment must ship offline (no label)
print_shipping_labelWhether to print the shipping label automatically
require_package_weightWhether package weight is required to finish packing
post_automation_urlURL to call after packing completes
use_blind_countBlind Count setting
reset_packing_progressReset Packing Progress On Incorrect Count setting
require_packaging_scanRequire Packaging Scan setting
require_box_firstRequire Box/Pallet Packaging First setting
require_manual_overrideRequire Manual Packing Solutions Override setting
require_item_sscc_associationRequire Item SSCC Association setting
fulfill_idThe Bulk Fulfill Order ID, if packing as part of one
bypass_weight_checkWhether the weight check is bypassed entirely
max_weight_check_failuresMaximum Weight Check Failures setting
weight_check_diff_minWeight Check Difference Minimum
weight_check_diff_percentWeight Check Difference Percentage
weight_check_diff_maxWeight Check Difference Maximum
scale_precisionWarehouse Scale Precision
bulk_packageBulk packaging data, when applicable
containersContainer details from the packing solution, if any
strict_containersWhether packages must match containers 1:1
initial_solution_idThe packing solution ID applied to the Shipment
container_stylesContainer display styles for the 3D solution viewer
skip_barcode_verificationSkip Barcode Verification setting
auto_packAuto-Pack Button mode

containers entries carry unit-suffixed length / width / height variants, same convention as the shipment weight fields.

Settable

Only the following config properties are read back after the script runs — anything else your script changes on config is silently ignored:

create_shipping_label, print_shipping_label, require_package_weight, reset_packing_progress, require_packaging_scan, post_automation_url, max_weight_check_failures, use_blind_count, weight_check_diff_min, weight_check_diff_percent, weight_check_diff_max.

Behavior Notes

  • Do not write a return statement — the script body runs directly (not inside a function), so return is a syntax error there. Just assign to config directly; its final value is used automatically.
  • Script changes apply after the Packing (Parcel) / Packing (Freight) configuration is resolved for the Shipment's type, so a script always wins over those settings.
  • print() output is shown at the bottom of the packing page as "Packing Start Script output: …".
  • A thrown exception — including a syntax error such as a stray return — is caught and shown as an info message, "Packing Start Script error: …", and does not block packing or raise any other warning. A script that silently fails to apply is usually this: check the packing page's info message for an error before assuming the setting was ignored.

Examples

Override the weight check band for a specific warehouse and Freight

// Freight shipments at warehouse 3 use a wider Percentage than the Freight default
if (shipment.shipment_type === 'freight' && shipment.stock_id === 3) {
    config.weight_check_diff_percent = 15;
}

Skip automatic label creation for a carrier

// This carrier's labels are always created manually
if (shipment.carrier_code === 'external') {
    config.create_shipping_label = false;
}