Order rules
How the Rules Engine integration with Commerce Layer Core API promotions resource works behind the scenes
Last updated
How the Rules Engine integration with Commerce Layer Core API promotions resource works behind the scenes
Last updated
When you filling up the related rules
object you're basically setting up order rules, meaning that the Core API integration will check your rules against the payload of an order. For performance reasons, it is a lightweight version of the , containing only the attributes and relationships needed to evaluate the rule and apply the related based on the values specified in the rule keys (e.g. fields, selectors, etc.).
The structure, constraints, and data types for the order rules JSON dataset are described in the public . Feel free to use it to implement validation scripts for your rules, automatically generate code, or just better understand how the Rules Engine works behind the scenes.
The following order rule offers free shipping and a 10% discount on the line items associated with an SKU if the email of the customer belongs to a specified domain: