Create a Cart Percent Discount with Account Tags
POST
Create a Cart Percent with Account Tags
https://useast.api.elasticpath.com/v2/rule-promotions
Parameters
Headers
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token required to get access to the API. |
Body
For descriptions about the other fields, refer to Promotions Builder API overview.
Name | Required | Type | Description |
---|---|---|---|
rule_set.rules.strategy | Required | string | The value for creating an Account Tags rule promotion is account_tags . |
rule_set.rules.operator | Required | string | The supported operators are contains_all and contains_any . |
rule_set.rules.args | Required | string | The list of account tag IDs used to determine eligibility. |
Request Example
curl -X POST https://useast.api.elasticpath.com/v2/rule-promotions \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $ {
"data": {
"type": "rule_promotion",
"name": "50 percent off cart with account tags",
"description": "50 percent off cart with account tags",
"enabled": true,
"automatic": true,
"start": "2024-01-01",
"end": "2024-01-26",
"rule_set": {
"rules": {
"strategy": "account_tags",
"operator": "contains_all",
"args": [
"3fa12770-cdf5-4168-a893-9a29eb1b43cc",
"31d60110-d492-4f93-983a-7cc466f12c54"
]
},
"actions": [
{
"strategy": "cart_discount",
"args": [
"percent",
50
]
}
]
}
}
}
Response Example
201 Created
{
"data": {
"type": "rule_promotion",
"id": "e42ec2df-5682-4047-bc22-9e5eb932ca4a",
"store_id": "85ea6cac-589a-4141-80d0-42b91aae73a7",
"name": "50 percent off cart with account tags",
"description": "50 percent off cart with account tags",
"enabled": true,
"automatic": true,
"rule_set": {
"catalog_ids": null,
"currencies": null,
"rules": {
"strategy": "account_tags",
"operator": "contains_all",
"args": [
"3fa12770-cdf5-4168-a893-9a29eb1b43cc",
"31d60110-d492-4f93-983a-7cc466f12c54"
]
},
"actions": [
{
"strategy": "cart_discount",
"args": [
"percent",
50
]
}
]
},
"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"
}
}
}
}