Promotions
How to set up promotions with the Rules Engine using order rules
Last updated
How to set up promotions with the Rules Engine using order rules
Last updated
The Rule Engine enables you to set up almost any kind of promotions to boost your sales, from the simplest to the most complex, using the proper order rules.
To make the Rule Engine work in conjunction with promotions, you need to leverage Commerce Layer . All you need to do is a new flex promotion and give it a meaningful name, specifying the activation and expiration dates as the values of the related attributes and the order rules that you want to be implemented in the rules
object. The discount defined by the related actions will be automatically applied to the orders that match the given conditions.
The following request creates a flex promotion that applies a 10% discount to the whole order if it contains at least 2 units of a promotional product:
The following action types are enabled on the flex promotions endpoint:
Where:
{{your_domain}}
is the unique subdomain of a Commerce Layer organization for which the Rules Engine is enabled.
{{promo_id}}
is the ID of the flex promotion whose outcomes you want to check.
{{order_id}}
is the ID of the order against which you want to validate the flex promotion.
Let's assume you want to check the flex promotion identified by the ID ZOqmZfjPOp
against the order identified by the ID NZrQhpRpRZ
:
The following flex contains a rule according to which the orders with a total amount greater than 5000 cents will be discounted by 10%:
Let's call the validation endpoint to check the rule's outcomes:
The following request validates the rule identified by the ID ZOqmZfjPOp
against the order identified by the ID NZrQhpRpRZ
:
Let's assume you want to check the same flex promotion against the order identified by the ID PgojhLQLQR
instead:
The following flex contains a rule according to which the orders with a total amount greater than 5000 cents will be discounted by 10%:
Let's call the validation endpoint to check the rule's outcomes:
The following request validates the rule identified by the ID ZOqmZfjPOp
against the order identified by the ID PgojhLQLQR
:
If you need to check more examples of promotions based on the Rule Engine, feel free to explore the related section of this documentation:
Once you've created a flex promotion (and defined one or more order rules) you can validate it against a specific order to check the rules outcomes (e.g. if and how the related discount will be applied in the case in point). You just need the flex promotion and the order IDs so that you can send (using a or access token) a GET
request to the endpoint: