Rule Promotions API Overview
The Rule Promotions Object
Name | Type | Required | Description |
---|---|---|---|
type | string | Required | Specifies the type of the resource. The type of resource for this promotion is rule_promotion . |
name | string | Required | Specifies a name for the promotion. |
description | string | Required | Specifies a description for the rule promotion. |
enabled | boolean | Required | Specifies whether the promotion is enabled. The options are true or false , and the default setting is false . |
automatic | boolean | Optional | Specifies whether the promotion is applied automatically to the cart or a code is required to apply the promotion. The default setting is false . When this value is set to true , a code is autogenerated. If this value is set to false , you must create the code manually. For more information about creating codes, see the Create Promotion Codes section. |
priority | integer | Optional | Specifies the priority of the promotion. Priorities are represented as integers, with higher numbers indicating higher priority. Each priority value must be unique, so no two promotions can have the same priority number. If there is no priority set, the most recently created promotion will be applied. Expired or inactive promotions can have duplicate priorities, but they must be changed to unique when reactived. To remove the priority, pass the null value in the update a Rule Promotion endpoint. For example, see Create a Rule Promotion with Priority. |
stackable | boolean | Optional | Specifies whether multiple promotions can be stacked to the same cart. By default, it is set to true . If set to false , the promotions cannot be stacked with other promotions. To create a Rule Promotion, for example, see Create a Rule Promotion with Stackable Flag. |
start | string | Required | Specifies the start date and time of the promotion or the start date of the promotion. You can provide a specific time in the HH:MM format. For example, "start": "2000-01-01 12:00" . If no time is specified, the default start and end time is set to 00:00 . |
end | string | Required | Specifies the end date and time of the promotion or the end date of the promotion. |
The rule_set
Object
Name | Type | Required | Description |
---|---|---|---|
rule_set.catalog_ids | string | Optional | Specifies the catalogs that are eligible for the promotion. By default, the promotion applies to all items, including custom items. However, when rule_set.catalog_ids is defined, the promotion is only applied to items within the specified catalogs. If catalog IDs are specified, custom items cannot be applied as part of the promotion. |
rule_set.currencies | string | Optional | Specifies currencies that are applied for the promotion. |
rule_set.rules.strategy | string | Required | Specifies strategies for the rule. Strategy decides how the rules are applied. The following strategies provide different criteria for applying rules, allowing for flexible and customizable promotion management:
and or or as needed to specify the criteria. The and strategy is applied when multiple conditions must all be met. The or strategy is applied when at least one of the multiple conditions must be met. |
rule_set.rules.children | string[array] | Optional | Specifies an array of rules within a rule set, particularly used when multiple rules are involved in defining a promotion. This structure allows for incorporating several rules within the same rule_set , where each rule establishes the criteria necessary for discount eligibility.Additionally, you can include sub conditions within the |
rule_set.rules.operator | string | Required | Specifies the operators used for the rule strategy. The eq , gt ,lt ,gte , and lte operators are supported in the following rule strategies:
in and nin operators are supported in the following rule strategies:
|
rule_set.rules.args | string / number | Required | Represents the condition value associated with each rule within the rule set. The number of supported arguments varies based on the rule strategy:
See Arguments |
The actions
object
Name | Type | Required | Description |
---|---|---|---|
rule_set.actions.strategy | string | Required | Defines how the discount is applied. The available options are:
|
rule_set.actions.args | string /number | Required | The first argument specifies the format for the discount value. The available options are:
fixed_price , the second argument indicates the multiplier, for example, X for amount, and the third argument is the price. For example, ["fixed_price", 4, 100]. See Arguments |
rule_set.actions.condition | object | Required | Defines how to apply discounts based on specified conditions. It supports multiple conditions and utilizes various strategies, operators, and arguments to determine when to apply the discount. See Create the Condition Rule Promotion.
Additionally, you can also include sub condition under |
rule_set.actions.limitations | object | Optional | Defines how limitiations are applied to promotions. These limitations dictate how the promotion can be used and what criteria must be met for it to be applied. For more information, see Action Limitations. |
Sample Response
{
"data": {
"type": "rule_promotion",
"id": "e42ec2df-5682-4047-bc22-9e5eb932ca4a",
"store_id": "85ea6cac-589a-4141-80d0-42b91aae73a7",
"name": "$5 off cart with custom attribute",
"description": "$5 off cart with custom attribute",
"enabled": true,
"automatic": true,
"priority": 100,
"rule_set": {
"catalog_ids": null,
"currencies": null,
"rules": {
"strategy": "cart_custom_attribute",
"operator": "in",
"args": [
"member_status",
"string",
"gold",
"platinum"
]
},
"actions": [
{
"strategy": "cart_discount",
"args": [
"fixed",
500
]
}
]
},
"start": "2024-01-01T00:00:00Z",
"end": "2024-01-26T00:00:00Z",
"meta": {
"timestamps": {
"created_at": "2024-01-24T21:27:13.1Z",
"updated_at": "2024-01-24T21:27:13.1Z"
}
}
}
}