Reduce Item's Discount
Automatically change the 100% discount on zero-value Linnworks order items to a configured discount, and offset the recovered value against a paid item on the same order.
Overview
Reduce Item's Discount is an automated order-pricing solution for Linnworks. It finds order items that have been given away free with a 100% discount and changes that discount to a configured value, so the item carries a value on the order.
The macro processes order IDs supplied through the Linnworks Rules Engine. For each order, it finds items where CostIncTax is 0 or less and Discount is 100, changes the discount to the configured discountValue, and marks the item with ItemValueChanged = Yes in its additional information.
The value added to those items is then taken off a paid item on the same order by reducing its PricePerUnit, so the order total stays as close as possible to the original amount.
Reduce Item's Discount gives free order lines a value, keeps the order total balanced against a paid item, and marks every changed item for review.
Who Should Use Reduce Item's Discount
Order Processing Teams
Teams handling orders with free or promotional items use the macro to remove manual line-by-line price edits.
Finance & Accounts Teams
Finance teams get a value on every order line while the overall order value is rebalanced against a paid item.
Integration Administrators
Administrators configure the discount value, set up the Rules Engine conditions and monitor the macro logs.
Customer Service Teams
Customer service teams use the ItemValueChanged marker to see which order lines were adjusted by the macro.
Key Features
Zero-Value Item Detection
Finds order items where CostIncTax is 0 or less.
100% Discount Replacement
Changes items with Discount = 100 to the configured discountValue.
Changed Item Marker
Adds ItemValueChanged = Yes to the item's additional information.
Paid Item Rebalancing
Reduces the PricePerUnit of one paid item on the same order by the value added to the free items.
Rules Engine Trigger
Processes only the orders supplied through the Rules Engine.
Detailed Logging
Logs every item checked, every item updated, the rebalance value and any errors.
How Reduce Item's Discount Works
Reduce Item's Discount runs through a defined sequence every time it processes one or more orders. The macro is triggered through the Linnworks Rules Engine and receives the relevant order IDs automatically.
Step 1: Order retrieval
The macro reads each order ID supplied through the OrderIds parameter and retrieves the order from Linnworks. Orders with no items are skipped.
Step 2: Zero-value check
Orders with no item where CostIncTax is 0 or less are skipped.
Step 3: Discount update
Each item where CostIncTax is 0 or less and Discount is 100 has its discount changed to discountValue, and the order item is updated in Linnworks.
Step 4: Rebalance value calculation
The new line cost (Cost) returned by Linnworks for each updated item is added to a running rebalance value.
Step 5: Item marker
If the item does not already have an ItemValueChanged entry, ItemValueChanged = Yes is added to its additional information.
Step 6: Paid item selection
If the rebalance value is greater than 0, the macro picks the first item on the order where CostIncTax is greater than 0 and greater than the rebalance value.
Step 7: Paid item price reduction
The selected item's PricePerUnit is reduced by the rebalance value and the order item is updated in Linnworks.
Configure the Macro
Once the app is installed, you need to create a macro configuration so the system knows which discount value to apply and allows the macro to be selected in the Rule Engine.
This setup can be adjusted anytime based on your operational requirements.
Steps to Configure
Go to Apps > Macro Configuration and click + Add new configuration.

Select the ApplyDiscountIfOrderItemValueZero macro and click Create Configuration.

This creates a new configuration where the parameter value can be entered.
In the Macro Configuration screen, add the configuration name and parameter value.

Configure the following parameter:
-
discountValue
50
Enter the new discount as a percentage number. For example, 50 changes a 100% discount to a 50% discount.
Make sure to enable the macro to continue with the Rule Engine configuration.

Note: If the macro is not enabled, it will not appear in the Action value list when setting up the rule.
Go to Orders > Rules engine and click + Add new rule.

Enter the rule name and click Create.

Click Add new, select Condition, set the condition as required, and save it.


Use conditions that target orders containing free items, for example orders from the channels or promotions that add 100% discounted items.
Add the macro action and click Save.


In the Add action window, enter the Action name, for example:
IfDiscountValueZero
-
Set Action type to:
Execute a macro -
In Action value, select:
ApplyDiscountIfOrderItemValueZero -
Click Save
Note: If the macro is not enabled, it will not appear in the Action value list when setting up the rule.
Review the saved rule setup.

- Verify the condition and action are connected correctly
- Click Save in the bottom-right corner to save the rule
Key Benefits
Changing the discount on free order lines and rebalancing another item by hand means checking prices, discounts and totals on every order. Reduce Item's Discount applies the same rules to every order it receives.
Remove manual price edits, give every order line a value, and keep a clear marker on each changed item.
Reduce Manual Edits
Removes the need to change discounts and unit prices on each order by hand.
Consistent Discounts
Every eligible free item receives the same configured discount.
Balanced Order Value
The value added to free items is taken off a paid item on the same order.
Clear Item Marker
ItemValueChanged = Yes shows which items were changed by the macro.
No Repeat Discount Changes
Once an item's discount is no longer 100, it is not changed again on later runs.
Easy Troubleshooting
Detailed log entries show every item checked and every value changed.
Usage of App
Reduce Item's Discount is triggered through the Linnworks Rules Engine to adjust free order lines on matching orders.
Execution
Trigger via Rules Engine
Call the ApplyDiscountIfOrderItemValueZero macro through the Rules Engine with the required OrderIds. No additional manual input is required once the rule is active.
Outcome
When the macro runs against an order, it:
Reads order data
Retrieves the order and its items from Linnworks.
Finds free items
Looks for items where CostIncTax is 0 or less and Discount is 100.
Updates the discount
Changes the discount on each free item to discountValue and saves the item.
Marks the changed items
Adds ItemValueChanged = Yes to each changed item's additional information.
Rebalances a paid item
Reduces the PricePerUnit of the first suitable paid item by the total value added to the free items.
The table below shows how the macro handles different situations:
| Order Situation | Macro Behaviour |
|---|---|
Free item with Discount = 100 and a suitable paid item | Discount is changed, the item is marked, and the paid item's PricePerUnit is reduced. |
Free item with Discount = 100 but no suitable paid item | Discount is changed and the item is marked. No item is reduced, so the order total increases. A warning is logged. |
Item with CostIncTax 0 or less but Discount not 100 | Item is not changed. |
No item with CostIncTax 0 or less | Order is skipped. |
| Order has no items | Order is skipped. |
| Error while updating one item | The error is logged and the macro continues with the next item. |
Input Parameters
Reduce Item's Discount requires the following input before it can process orders:
| Parameter | Required | Description |
|---|---|---|
| OrderIds | Yes | The Linnworks order IDs to process. Passed through the Rules Engine trigger. |
| discountValue | Yes | The new discount percentage for free items, for example 50 for a 50% discount. |
The following behaviour is defined within the macro code:
| Setting | Description |
|---|---|
| Eligible Item Rule | CostIncTax is 0 or less and Discount is exactly 100. |
| Rebalance Value | The total of the new line cost (Cost) returned by Linnworks for every updated free item. |
| Paid Item Rule | The first item on the order where CostIncTax is greater than 0 and greater than the rebalance value. |
| Price Adjustment | The full rebalance value is taken off the paid item's PricePerUnit. |
| Item Marker | ItemValueChanged = Yes in the item's additional information, added only if not already present. |
Rebalancing Rules
The macro uses the following rules when rebalancing an order:
| Rule | How It Works |
|---|---|
| One paid item only | The whole rebalance value is taken off one item. It is never spread across several items. |
| First suitable item | The first item in the order's item list that meets the paid item rule is used. |
| Unit price is reduced | The rebalance value is taken off the unit price, not the line total. |
| No suitable item | If no paid item is large enough, nothing is reduced and a warning is logged. |
| Repeat runs | A changed item no longer has Discount = 100, so it is not changed or rebalanced again on later runs. |
Important: The rebalance value is taken off the paid item's unit price. If that item has a quantity greater than 1, its line total is reduced by the rebalance value multiplied by the quantity. Check orders with multi-quantity paid items after the macro runs.
Best Practices
Testing on a few orders and checking order totals after the first runs are key to getting the best results from Reduce Item's Discount.
Use targeted rule conditions
Run the macro only on orders that can contain free items, such as specific channels or promotions.
Choose the discount carefully
Enter discountValue as a percentage number, for example 50. Do not enter 100.
Check order totals
Compare the order total before and after the macro runs, especially when the paid item has a quantity above 1.
Watch for unbalanced orders
Search the logs for "No suitable item found" to find orders where the total increased.
Test before enabling at scale
Run the macro against a small set of orders with known free items before enabling it on all orders.
Review the item marker
Use ItemValueChanged = Yes to find and review the items the macro changed.
The following checks can help diagnose common issues:
| Issue | Check |
|---|---|
| Order was not changed | Confirm the order matched the rule and contains an item with CostIncTax 0 or less and Discount 100. |
| Free item was not changed | Check that the item's discount is exactly 100. |
| Paid item was not reduced | Check for an item where CostIncTax is greater than the rebalance value. Review the macro log for a warning. |
| Order total is lower than expected | Check whether the reduced paid item has a quantity greater than 1. |
| Order total is higher than expected | No suitable paid item was found. Adjust the order manually. |
| Macro does not appear in the rule | Confirm the macro configuration is enabled. |
FAQ
How is Reduce Item's Discount triggered?
The macro is triggered through the Linnworks Rules Engine. When an order matches a configured rule, the macro receives the relevant OrderIds automatically.
Which items does the macro change?
Items where CostIncTax is 0 or less and Discount is exactly 100.
What does discountValue mean?
It is the new discount percentage for free items. For example, 50 changes a 100% discount to a 50% discount.
How is the rebalance value calculated?
It is the total of the new line cost (Cost) that Linnworks returns for every free item the macro updates.
Which paid item is reduced?
The first item on the order where CostIncTax is greater than 0 and greater than the rebalance value.
Is the rebalance spread across several items?
No. The whole rebalance value is taken off one item.
Is the line total or the unit price reduced?
The unit price (PricePerUnit). If the paid item has a quantity greater than 1, the line total is reduced by the rebalance value multiplied by the quantity.
What happens if no paid item is large enough?
The free items are still changed, but no item is reduced, so the order total increases. A warning is written to the log.
What does ItemValueChanged mean?
It is a marker added to the item's additional information to show that the macro changed its discount.
Does ItemValueChanged stop the item from being changed again?
No. The macro does not check the marker. An item is not changed again because its discount is no longer 100 after the first run.
What happens if one item fails to update?
The error is logged and the macro continues with the other items and orders.
Can the eligibility or rebalancing rules be changed?
Yes. The macro code must be updated and tested before the new rules are used in a live workflow.
Legal Information
- Privacy Policy: https://rishvi.co.uk/privacy-policy/
- Terms and Conditions: https://rishvi.co.uk/terms-conditions/
Please review these pages to understand how data is handled and the terms governing the use of this application.
Summary
Reduce Item's Discount automates the adjustment of free order lines on selected Linnworks orders.
Once configured through the Rules Engine, the macro finds items with a 100% discount and no value, changes their discount to the configured value, marks each changed item, and takes the added value off the unit price of a paid item on the same order.
Automatic discount update
Free items with a 100% discount receive the configured discount.
Order value rebalancing
The added value is taken off one paid item on the same order.
Rules Engine automation
Matching orders are supplied to the macro automatically through the configured rule.
Traceable changes
Changed items are marked with ItemValueChanged = Yes.
For orders that do not produce the expected result, review the macro log, confirm that the macro configuration is enabled, and check that the free item has a discount of exactly 100 and the order has a paid item large enough to absorb the rebalance value.