Percentage
How the percentage discount action works, what are the required and optional parameters to set it up, and the resources for which it's enabled
Actions of type percentage enable you to apply a percentage discount to the amount of a specific field.
When setting up a percentage discount action, in addition to the action type, you need to specify at least the attribute or resource on which to apply the action as the selector key value and fill the value key with the float number corresponding to the percentage discount to be applied (for more information on the parameters listed in the table below and how they work please refer to the main actions page):
Example
The following action applies a 20% discount to the amount of all the line items associated with an SKU among the ones grouped as discountable-items within the related condition matchers:
"actions": [
{
"type": "percentage",
"selector": "order.line_items.sku",
"groups": [ "discountable-items" ],
"value": 0.2,
}
]Value
The percentage to be discounted is defined by the value key which must be provided in decimal form as a float number between 0 and 1.
Round
If you want to avoid displaying or dealing with decimal values in discounts or final prices when using percentage discount actions (e.g. to simplify the shopping experience and/or make offers appear cleaner and more user-friendly), you can leverage the round key and set its value to true. This way, the related percentage discounts will be rounded off to the nearest integer.
Promotions — the rounding happens at the discount level, meaning that the discount amount is calculated and rounded first, then subtracted from the item price.
Price lists — the rounding happens at the price level, meaning that the discount amount is calculated and subtracted from the item price first, and the resulting price is then rounded.
Restrictions
Percentage discount actions support bundles, provided that one or more groups among the ones defined when grouping the matches of the related conditions are specified.
You can set a limit on percentage discount actions only if you're not using bundles.
Resources
Last updated

