Replacing Order Items with Rules (New Version)
A complete guide to the Replace Order Items (New Version) rule action: swap sets of SKUs for bundles, variety packs or gifts when an order is sent to your warehouse plugin or webhook.
Last updated 14 days ago
Replace Order Items (New Version) is a rule action that swaps items on an order just before Neuro sends it to your warehouse plugin or webhook. Use it when what the customer bought is not what the warehouse should pick, for example:
Bundles: a tree and a storage bag bought separately are picked as one pre-packed bundle.
Variety packs and mystery items: a "surprise" SKU is replaced by one or more real products picked at random.
Free gifts: a gift SKU is swapped for whichever gift is in stock.
Kits: a set of SKUs is sent as a kit, or a kit as a different kit.
This action replaces the original Replace Order Items action. The original can no longer be added to new rules, but rules that already use it keep working.
Before you start
The action is available on selected plans. If you see a lock icon or an upgrade prompt, contact your account manager or Neuro Support.
It only works with the triggers Order > When Sending To Plugin and Order > When Sending To Webhook. You need a warehouse plugin or a webhook that receives orders.
Every SKU you use as a source, target or fallback must exist as a product in Neuro.
If you are new to rules, read Automating Your Workflow with Rules first.
How it works
An order is about to be sent to your plugin or webhook, and the rule's conditions match.
Neuro looks for complete sets of your source items on the order. A set is every source SKU in at least its required quantity.
For each full set, Neuro removes the source units and adds the target items in their place.
The order goes out to the plugin or webhook with the target items.
The order saved in Neuro does not change. Only the copy sent to the plugin or webhook carries the replacement. Neuro keeps a record of what was replaced, and when the warehouse ships the target items, the shipment is matched back to the original order lines.
Step 1: Create the rule and choose the action

Steps shown in the screenshot:
Enter a rule name.
Choose Order as the trigger object.
Choose When Sending To Plugin or When Sending To Webhook as the event.
Under Then Actions, choose Order as the action type.
Choose Replace Order Items (New Version) as the action.
You can add conditions as usual, for example only for one channel or one store, so the swap only applies to the orders you want.
Step 2: Add the source and target items

Steps shown in the screenshot:
Enter each source SKU and its required quantity.
Click Add another source SKU to add more source SKUs. All of them must be on the order.
Enter each target SKU and its quantity.
Click Add another target SKU to add more targets.
Source items
All source SKUs must be on the order, each in at least the Required qty, for the rule to fire.
The rule runs once for every full set on the order. With a tree and a bag as the source, an order with 2 trees and 2 bags makes 2 replacements.
Units that do not make a full set stay on the order unchanged. With 3 trees and 2 bags, 2 sets are replaced and 1 tree is sent as it is.
If the same SKU is split across several order lines, Neuro adds the lines together.
Neuro matches the SKU exactly as it appears on the order line, so "007" does not match "7".
At most 100 sets are replaced on one order.
Target items
Targets are put on the order in place of each set, at the Quantity you enter for each one, multiplied by the number of sets.
A target SKU cannot also be one of the source SKUs.
Kits can be used as sources or targets. A kit is matched on its own SKU.
What happens to prices
The value of the source units that are removed (price, tax and discount) is shared equally between the new target lines. Any rounding difference goes on the last line, so the order total sent to the plugin or webhook stays the same. If a source line is only partly used, it keeps its remaining units with its totals reduced to match.
Step 3: Choose the options

Steps shown in the screenshot:
Turn on Randomly select from target SKUs to pick only some targets.
Enter how many targets to select.
Turn on Avoid targets the customer just had.
Enter the look-back period in days, up to 30.
Choose what happens if too few targets are left.
Leave Check stock before replacing on to check target stock.
Choose what happens when there is not enough stock.
Randomly select from target SKUs
Turn this on to pick some of the targets instead of all of them, for variety packs, mystery items or gifts. Enter the Number of targets to select. It cannot be more than the number of target items.
For each set, Neuro picks that many different targets at random, with no repeats on the same order. An order with 2 sets and 1 target to select gets 2 different targets.
Targets that are already on the order are not picked.
If there are not enough different targets for every set, only the sets that can be covered are replaced.
With this option off, every target is added for every set.
Avoid targets the customer just had
Turn this on so a customer does not receive the same target again within a period. Enter the number of days in Avoid targets received in the last (days), up to 30.
Neuro looks at the same customer's other orders in the same store created within that period. Cancelled, refunded and returned orders are ignored. Unshipped orders do count.
Targets swapped into those earlier orders count too.
If too few targets are left that the customer has not just had, choose what happens:
When every target is used (random selection off), one target the customer recently had is enough for this setting to apply. With random selection on, it applies when fewer targets are left than the number to pick.
Check stock before replacing
On by default. Neuro only replaces when every target has enough stock where the order is being sent:
Sending to a plugin: the stock that plugin reports for the target.
Sending to a webhook: the target product's API quantity in Neuro.
Kit targets are checked on their child items, not on the kit SKU.
Targets without enough stock are left out before any random pick. When there is not enough stock, choose what happens:
Choosing Excluded for a plugin order lets your other routing rules send the order to a different plugin. An On Hold order is checked again when you release it.
Step 4: Save and activate the rule
Click Save Changes, then check the rule's Active switch on the Rules page. Test with a small set of orders first, for example by adding a condition for one channel.
Examples
Bundle. Source: SKU-TREE × 1 and SKU-BAG × 1. Target: SKU-BUNDLE × 1. Check stock on, Do not Replace. An order with 2 trees and 2 bags is sent as 2 bundles. An order with 2 trees and 1 bag is sent as 1 bundle and 1 tree. If the warehouse has no bundles, the order is sent unchanged.
Mystery item. Source: SKU-GIFT-01 × 1. Targets: SKU-002, SKU-003 and SKU-004, each × 1. Random selection on, 1 target. Avoid targets the customer just had, 30 days, Allow repeat. Check stock on, Randomly replace with any target. Each gift set is sent as one surprise item the customer has not had in the last 30 days, if possible.
Checking what happened
Order Activities: the order page's Activities list shows an order item replaced entry, with the sets matched, what was taken off, what was added, whether stock was checked and whether a fallback was used.
Rule records: the rule's records in Activity Records > Rule Engine Records explain why the rule did or did not replace items.
Webhooks: the order lines in the webhook payload show the target SKUs.
Sending an order again
When an order is pushed to a plugin again, or sent to a webhook for the first time again, Neuro works the replacement out again. A random choice can change.
When an updated order is sent to a webhook, Neuro keeps the earlier replacement, as long as the order still holds the units that were replaced.
If an order goes out without a replacement, the earlier replacement record is cleared.
Things to know
The default when stock is short is Do not Replace, which sends the original source SKU. If your warehouse cannot pick the source SKU (for example a mystery SKU), choose another option.
The look-back for avoiding repeats is at most 30 days, and it matches the customer record in Neuro, not the email address.
If the plugin record for an order has been removed, the stock check is skipped and the replacement goes ahead.
A send rule that changes an order's status (for example to On Hold or Excluded) stops that send.
Related guides
Rule Actions Reference
Automating Your Workflow with Rules
Resend Orders to Webhooks or Plugins via Bulk Update
Was this helpful?
More in Rules and Automation
Automating Your Workflow with RulesRule Actions ReferenceStill need help? Share an idea