Fixed price
How the fixed price action works, what are the required and optional parameters to set it up, and the resources for which it's enabled
Actions of type fixed_price enable you to overwrite the unit amount of a specific field with a desired value.
When setting up a fixed price 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 integer number corresponding to the new price in cents that you want to set (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 set to 2000 cents the unit amount of all the line items associated with an SKU among the ones grouped as discountable-items within the related condition matchers:
"actions": [
{
"type": "fixed_price",
"selector": "order.line_items.sku",
"groups": [ "discountable-items" ],
"value": 2000,
}
]Value
The new amount that you want to set is defined by the value key which must be provided in cents (e.g. 1500 applied to a order with currency code EUR corresponds to 15€).
Quantity
The quantity parameter allows you to override the actual quantity of the resource when applying the fixed price action. When specified, the action will be applied to the minimum between the specified quantity value and the actual resource quantity.
This parameter is particularly useful when you need to limit the number of items that receive a discount, regardless of how many units are actually in the cart. The action applies to the specified number of items, while any remaining items beyond that quantity will not receive the discount. One common use case is implementing a free gift promotion. By combining quantity: 1 with value: 0, you can make exactly one item completely free while charging the original price for any additional units.
This parameter affects how many items receive the discount only, not the price value itself. For example, if you set it to 2 on a line item with 5 units, only 2 units will be set to the specified price, while the remaining 3 units will be charged at their original price.
Example
The following action implements a Buy one, get one free promotion where the first unit of products among the ones grouped as promotional-items within the related condition matchers is completely free (price set to 0), while any additional units are charged at their original price:
The fixed price action with value: 0 and quantity: 1 provides the most straightforward way to implement free gift promotions, as it doesn't require knowing the item's original price (unlike the fixed amount approach) and explicitly sets the price to zero (more intuitive than the percentage approach with 100% discount).
Restrictions
Fixed price 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 fixed price actions only if you're not using bundles.
Resources
As regards the Rule Engine integration with Commerce Layer Core API, the fixed price action type is available both for promotions (order rules) and price lists (price rules).
Last updated