Creating Routing Rules

Order routing is the core engine of the app. It determines where to send your order for fulfillment after it’s pulled from the selling channel. By configuring order routing with custom rules, you can define detailed logic for each order scenario.

At least one routing rule is required unless your orders are pre-routed in your ERP or selling channel with a fulfillment location already assigned.

Order Routing is structured around Order Routing Cards. Each card contains rules and filters that direct orders to the correct fulfillment location.

Common use cases:

  • Route orders to the closest warehouse to the customer’s shipping address.

  • Route orders based on inventory availability.

  • Route orders based on SKU or order attributes.

  • Split or combine line items using advanced rules.

Learn more about routing in this course.


How Order Routing Works

When a new order enters the app:

  1. The system evaluates routing rules in sequence, from top to bottom.

  2. Each card is tested. If its filters and fulfillment locations do not apply, the rule is skipped.

  3. Once a card meets the criteria, the app selects the first matching fulfillment location with available inventory.

  4. If no match is found, Order Routing will generate an exception and set the routingStatus to failed even if the order status remains in Ready For Fulfillment.

    This will also affect when the order will be re-routed. It will be moved to the failed order queue and be retried every 3 hours.

Use filters to handle special cases first (e.g., wholesale, pre-orders, or drop-ship). General rules should follow in the sequence.


Creating Routing Rules

  1. Go to Order Routing from the left navigation.

  2. Select Add Order Routing at the bottom of the page.
    A new card appears with these fields:

    • Name: Free-text entry for identifying the rule (e.g., West Coast Routing or Wholesale Orders).

    • Filters: Optional conditions that must be met for the card to apply.

    • Destination Fulfillment Preferences: A prioritized list of fulfillment locations. The first match with available inventory is chosen.

    • Advanced Options: Configure split orders, inventory checks, and future orders.

  3. Use the drag handles to reorder cards. Rules at the top are evaluated first.

Adding Filters

Inside the routing card, click Add Filter. You'll see two filter types to choose from:

  • Simple filter - Build conditions using fields, operators, and values. Use this for straightforward logic such as filtering by SKU, shipping state, or order tag.
  • Code filter (JavaScript) - Write JavaScript that returns true or false to determine whether the rule applies. Use this when your logic can't be expressed with simple field/operator/value conditions (for example, calculations across multiple fields, string parsing, or conditional combinations). This works the same way as the code filter in automation rules.

Simple Filter

  1. Select Simple filter.
  2. In the Create Advanced Filter window, enter a Filter Name.
  3. Define conditions using:
    • Field (e.g., SKU, Shipping Address State).
    • Operator (Equals, Contains, Equals Any Of).
    • Value (e.g., CA, NY, or SKU123).
  4. Combine conditions with AND / OR logic.
  5. Click Preview to verify the filter. This opens the Orders page with your conditions applied as a search query, so you can confirm the rule will catch the orders you expect before saving.
  6. Return to the routing card, click Save & Apply, then save changes to the card.

Code Filter (JavaScript)

The code filter uses JavaScript to evaluate whether the routing rule applies to an order. The script must return true to route the order through this rule, or false to skip to the next rule. The full order object is available as the order variable.

  1. Select Code filter (JavaScript). The Add Code Filter window opens with a built-in code playground.
  2. Load order data to test against:
    • Click Load latest order to pull in your most recent order, or
    • Enter a Pipe17 Order ID and click Load.
  3. Write your JavaScript in the Code panel. For example:

    return order.total > 100;

  4. Click Test code to run the script against the loaded order. Use the view tabs to inspect:
    • Input - the order variables available to your code.
    • Code - your script.
    • Output - the true/false result and any Debug output.
  5. Click Test code to run the script against the loaded order. The Output panel shows the result:
    • Passed (green checkmark) - "The input passed through the filter." The script returned true, so the rule would apply to this order.
    • Failed (red X) - "The input did not pass through the filter." The script returned false, so the rule would skip this order.
    • The Debug section beneath the result displays any log output or errors from your script.
  6. Adjust the code and rerun Test code until the filter behaves as expected.
  7. Click Save & Apply, then save changes to the routing card.

If no valid fulfillment locations are assigned, the rule will be skipped (the UI displays a red warning).

Setting Fulfillment Preferences

  1. In the routing card, go to Destination Fulfillment Preferences.

  2. Add one or more fulfillment locations.
    Example:

    • Seattle – 3PL (Active)

    • New Jersey – 3PL (Active)

  3. Drag locations into priority order. The system always attempts the first valid match.

  4. Click Save changes.


Advanced Options

Each routing card includes additional checkboxes:

  • Do Not Check Inventory: Ignores inventory levels and always routes to the first listed location.

  • Allow Split Orders: Splits orders across multiple locations if no single location has all items.

  • Send Future Orders Immediately: Considers future incoming stock as available.

  • Optimize for Location Priority: Routes based on location sequence when splitting.

For complex cases, you can also apply a Line Item Filter (beta) to split specific SKUs or items. 

When the app evaluates routing for orders that include alternate SKUs, see Alternate SKU evaluation in Routing Rules (High-Level Concept) for how the app selects between substitution options.

Here’s a Test Routing Rules section written to match the KB style and the UI shown in your screenshot. It explains the purpose and the available options clearly, without over-technical detail.


Test Routing Rules

The Test Routing Rules feature lets you safely validate how your order routing logic will behave before it impacts live fulfillment. It simulates routing decisions using real or sample order data and shows exactly which rules and locations would be applied.

Click the Test routing rules button in the Routing Rules page to confirm rule logic, filter behavior, inventory handling, and location prioritization without creating or sending shipping requests to a 3PL.

When to Use Test Routing Rules

  • Before enabling new routing rules

  • After updating filters or fulfillment locations

  • When troubleshooting unexpected routing behavior

  • When validating routing changes during onboarding or expansion

Test Routing Options

Setting

 

Description

 

ID Type

Select the identifier used to fetch the order. Pipe17 Order ID is supported.

Pull latest order

Automatically loads the most recent order into the test window. Useful for quick validation.

Paste Pipe17 Order ID

Manually enter a specific order ID to test routing behavior for a known order.

Order JSON

Displays the full order payload used for the routing simulation. This reflects the data the routing engine evaluates.

Test Order As Is

Tests routing using the order’s current state, including existing routing history and attributes.

Test Order As a Net New Order

Tests routing as if the order were newly ingested, ignoring prior routing attempts. Useful for validating new rules.

Test Result

Displays the routing outcome, including which rules matched, which locations were evaluated, and the final routing decision.

Best Practices

  • Use Test Order As a Net New Order when validating newly created or reordered routing rules.

  • Use Test Order As Is when troubleshooting an order that already attempted routing.

  • Review the Test Result carefully to confirm rule order, filter matches, and location eligibility.

  • Pair test results with Order Routing Runs for deeper visibility into live routing behavior.

Testing routing rules helps ensure accuracy, reduces fulfillment errors, and prevents unnecessary manual intervention before orders reach your fulfillment partners.


Order Routing Settings

Order Routing Settings give you fine-grained control over how the Order Routing Engine processes orders, handles edge cases, manages inventory allocation, and determines when manual review is required. These global settings affect how shipping requests are created, re-routed, canceled, or flagged for review.

Setting Category

Setting

Type

Default Value

Description

General

Only enable order routing for orders created after this time

Date / Calendar

Not set

Prevents the routing engine from processing orders created before the specified date and time. Useful when implementing routing rules and excluding historical orders. Not setting a date enables routing for all orders.

Manually release each shipping request

Toggle

Disabled

Requires manual approval before shipping requests are sent to fulfillment providers. Provides full control over each routing decision.

Require review for auto re-routing orders created X days ago

Toggle

Disabled

When enabled, older orders being automatically re-routed are marked for manual review instead of being released automatically.

Review required for auto re-routing orders created X days ago

Number (days)

5 days

Defines the age threshold for the above setting. Orders created more than this number of days ago require review before re-routing.

Cancel Order if no inventory is found for all items

Toggle

Disabled

Automatically cancels an order when no inventory is available across all fulfillment locations. Prevents orders from remaining in a pending state indefinitely.

Auto cancel orders that have all shipping requests canceled

Toggle

Disabled

Automatically cancels the order when all associated shipping requests are canceled, keeping order status aligned with fulfillment activity.

Auto fulfill orders with no shippable items

Toggle

Enabled

Automatically marks orders as fulfilled when they contain only non-shippable items such as digital goods or services.

Stuck Orders

Auto re-route stuck orders every 3 hours

Toggle

Disabled

Automatically attempts to re-route orders that are stuck (for example, waiting on inventory) at regular intervals.

Auto re-route stuck orders less than X days old

Number (days)

30 days

Limits automatic re-routing to orders within this age threshold. Prevents repeated attempts on very old orders.

Inventory Buffer

Inventory buffer threshold

Number (units)

5 units

Acts as a per-run timing safeguard rather than a hard inventory floor. When an order's available inventory at a location falls at or below this threshold during a routing attempt, the engine pauses routing for that run and retries approximately 5 minutes later. If inventory levels remain the same on retry, the order can still route successfully - this is expected behavior. Helps reduce race conditions and overselling during high-volume periods.

Pre-Routed Orders / Items

Create Shipping Request for Pre Routed Orders/Items

Toggle

Disabled

When enabled, creates shipping requests for orders or items that already contain routing information. When disabled, pre-routed items bypass the routing engine.

Out of Stock Orders

Out of stock order faster re-routing age limit

Number (days)

15 days

Defines how long an out-of-stock order is eligible for more frequent re-routing attempts. Newer orders are retried more frequently than older ones.

Failed Orders

Failed order faster re-routing age limit

Number (days)

15 days

Defines the age threshold for failed orders to receive more frequent re-routing attempts before transitioning to less frequent retries.

Future Inventory

Route orders using future inventory (deprecated)

Dropdown

Utilize Current & Future Inventory

Controls whether incoming or future inventory is considered during routing.

  • Utilize Current & Future Inventory (Default): considers both on-hand inventory and future incoming inventory when checking if a location can fulfill an item. In practice, this means a location with 0 current stock but incoming stock can still be selected, resulting in a pendingInventory shipping request.

  • Ignore Future Inventory: only current on-hand inventory is considered. Locations with no current stock are skipped even if they have incoming inventory.

Overship Prevention

Set Review Required When More Than 1 Shipping Request Is Created Per Order

Toggle

Disabled

Flags orders for manual review when routing creates multiple shipping requests (split shipments). Helps prevent unintended split fulfillment.

Over-fulfillment Policy (deprecated/readonly)

Dropdown

strict

Controls behavior when potential over-fulfillment is detected.

  • Raise exception and mark shipping request for manual review (default): when potential overfulfillment is detected, an exception is raised and the shipping request's status is set to reviewRequired, blocking it from being sent to the 3PL until manually released. This is the safer, blocking mode.

  • Raise exception but send the shipping request for fulfillment: when potential overfulfillment is detected, an exception is raised (to notify the operator) but the shipping request proceeds to readyForFulfillment and is sent to the 3PL. This is the non-blocking, notify-only mode.

Order Routing Runs

Order Routing Runs provide a complete record of how the app evaluated and routed each order. Think of them as a “black box recorder” for your routing engine, giving you transparency into every decision made.

Order Routing Runs Use Cases

  • Audit Trail and Transparency: Captures what happened (rules and locations evaluated), why it happened (decision logic and inventory levels), when it happened (timestamps), and what the outcome was (shipping requests created or exceptions raised).

  • Troubleshooting and Debugging: Explains unexpected behavior by showing which rules matched or failed, available inventory at each location, reasons locations were excluded, and exceptions generated.

  • Performance Monitoring: Highlights orders that frequently fail to route, bottlenecks in the routing process, and patterns in routing failures.

  • Compliance and Reporting: Provides auditable records of fulfillment decisions for compliance or analysis purposes.

Key Fields in Routing Runs

Run ID (orderRoutingRunId)

  • A unique identifier for each routing attempt.

  • Lets you track multiple routing attempts for the same order.

  • Links directly to the routing logs, inventory snapshots, and shipping request outcomes.

Ext Order ID (extOrderId)

  • The external order identifier from the selling channel (Shopify, Amazon, etc.).

  • Connects routing runs to the order record you recognize from your sales channel.

  • Enables troubleshooting across systems and supports cross-channel reporting.

Other Settings

In the engine, you can also:

  • View JSON for technical details, as well as edit it.

  • Compare settings with other integrations.

  • Export and import engine settings (for example, reusing configurations from sandbox to production).

  • All configuration changes are recorded in the Activity section within the engine. Like other integrations.


Troubleshooting

Issue

 

Cause

 

Resolution

 

Routing Rule Skipped

No valid fulfillment locations are assigned, or inventory requirements aren’t met.

  • Verify the rule has at least one active fulfillment location.

  • Check if an inventory buffer or “Do Not Check Inventory” setting is restricting location eligibility.

  • Review the order’s filters to confirm they match the intended logic.

Order Stuck in Ready for Fulfillment

No rule matched the order, or inventory was insufficient across all locations.

  • Reorder or refine routing rules to ensure a fallback location exists.

  • Use Routing Runs to identify which rules were evaluated and why they failed.

  • Enable Auto re-route stuck orders in settings if appropriate.

Unexpected Location Chosen

Location priority or split order settings influenced the routing.

  • Confirm the sequence of fulfillment locations in the routing card.

  • Check if “Allow Split Orders” or “Optimize for Location Priority” is enabled.

  • Review Routing Run logs to see why the selected location was prioritized.

Order Not Routing Due to Inventory Inventory at a location was at or below the buffer threshold during the routing attempt, or no stock is available.
  • If an order fails routing with an inventory threshold message and then succeeds shortly after with the same inventory levels, this is expected behavior. The inventory buffer threshold triggers a per-run pause (~5 minutes) before the engine retries - it does not permanently block routing or require inventory to change.
  • Verify inventory sync between sales channels and the app if orders are not retrying.
  • Adjust or disable the inventory buffer threshold if the delay is too restrictive for your workflow.
  • Use "Do Not Check Inventory" for drop-ship or made-to-order items.

Order Auto-Canceled

Global settings canceled orders with no available inventory or when all shipping requests were canceled.

  • Check if Cancel order if no inventory or Auto cancel orders settings are enabled.

  • Adjust settings if cancellation is not desired.

Orders Requiring Manual Review

Manual release, review for old orders, or split shipping requests are enforced by settings.

  • Confirm whether the manual review requirement is intentional in your process.

  • Adjust Review Required or Manually Release settings if automation is preferred.

Over-Fulfillment Exceptions

The system detected a potential overship scenario.

  • Check the Over-fulfillment Policy setting.

  • Choose between strict prevention (default) or reporting-only depending on your needs.

Failed or Out-of-Stock Orders Not Retrying

Orders exceed re-routing age limits or settings are disabled.

  • Verify the Out-of-stock order age limit and Failed order re-routing age limit in settings.

  • Increase thresholds if you want older orders retried more frequently.

Using Routing Runs for Troubleshooting

Lack of visibility into why routing decisions were made.

  • Look up the Ext Order ID to see all routing attempts for an order.

  • Use the Run ID to view detailed logs, including rules evaluated, inventory levels, and exceptions.

  • Compare multiple runs to understand what changed between attempts.

Code filter not matching expected orders The JavaScript expression returns false for orders you expect to match, or throws an error during evaluation. Open the filter and run sample orders through the code playground to confirm the script returns true for the intended cases. Check for syntax errors, undefined fields, or type mismatches (e.g., comparing a number to a string).

Need Help?

If you need additional assistance:

We're here to help you succeed with your operations.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.

Have more questions?
Submit a request
Share it, if you like it.