Schedule MacroRIS-SM-1015 – REDUCE ITEM DISCOUNT

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

Key Features

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.

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.

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 SituationMacro Behaviour
Free item with Discount = 100 and a suitable paid itemDiscount is changed, the item is marked, and the paid item's PricePerUnit is reduced.
Free item with Discount = 100 but no suitable paid itemDiscount 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 100Item is not changed.
No item with CostIncTax 0 or lessOrder is skipped.
Order has no itemsOrder is skipped.
Error while updating one itemThe 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:

ParameterRequiredDescription
OrderIdsYesThe Linnworks order IDs to process. Passed through the Rules Engine trigger.
discountValueYesThe new discount percentage for free items, for example 50 for a 50% discount.

The following behaviour is defined within the macro code:

SettingDescription
Eligible Item RuleCostIncTax is 0 or less and Discount is exactly 100.
Rebalance ValueThe total of the new line cost (Cost) returned by Linnworks for every updated free item.
Paid Item RuleThe first item on the order where CostIncTax is greater than 0 and greater than the rebalance value.
Price AdjustmentThe full rebalance value is taken off the paid item's PricePerUnit.
Item MarkerItemValueChanged = 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:

RuleHow It Works
One paid item onlyThe whole rebalance value is taken off one item. It is never spread across several items.
First suitable itemThe first item in the order's item list that meets the paid item rule is used.
Unit price is reducedThe rebalance value is taken off the unit price, not the line total.
No suitable itemIf no paid item is large enough, nothing is reduced and a warning is logged.
Repeat runsA 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.

The following checks can help diagnose common issues:

IssueCheck
Order was not changedConfirm the order matched the rule and contains an item with CostIncTax 0 or less and Discount 100.
Free item was not changedCheck that the item's discount is exactly 100.
Paid item was not reducedCheck for an item where CostIncTax is greater than the rebalance value. Review the macro log for a warning.
Order total is lower than expectedCheck whether the reduced paid item has a quantity greater than 1.
Order total is higher than expectedNo suitable paid item was found. Adjust the order manually.
Macro does not appear in the ruleConfirm 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.

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.

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.