Create advanced discount

Update a specific promotion existing in the store by its ID

Access scopes

Requires the following access scope: create_promotion

Path params

ParamTypeDescription
storeIdnumberEcwid store ID.

Headers

The Authorization header with a secret access token is required.

HeaderFormatDescription
AuthorizationBearer secret_ab***cdAccess token of the application.

Request

Send a JSON-formatted body with some of the following fields:

FieldTypeDescription
namestringName of the discount displayed at the checkout.

Max length: 1024 symbols.
discountBasestringBase from which discount is calculated on the checkout. Supported values:
"ITEM" – discount is applied only for products/categories specified in the targets array.
"SUBTOTAL" – discount will be applied to all products added to the cart.
"SHIPPING" – discount will be applied to all products added to the cart.
enabledbooleantrue if promotion is enabled, false otherwise
discountTypestringDescribes if the discount is calculated as a percent or an absolute value. Supports only two values: "PERCENT" or "ABSOLUTE".
amountnumberDiscount amount. Value is applied as an absolute sum or a percent depending on the "discountType" field.
triggersArray triggersTriggers that define when the discount is applied. Supports restricting by date, customer group and subtotal in any combination.
targetsArray targetsLimit the discount by categories, specific products, combinations and even attributes customer group and subtotal in any combination.

triggers

Set up triggers when the discount from promotion should be applied on the checkout:

FieldTypeDescription
startDatestringDate and time to start the promotion
endDatestringDate and time to end the promotion
customerGroupsArray of numbersCustomer group IDs for the promotion.

Maximum number of IDs: 200.
subtotalnumberMinimum cost of products added to the cart for the promotion to be applied

targets

Restrict promotion by specific products, categories, product variations (combinations), and attributes:

FieldTypeDescription
categoriesArray of numbersRestrict promotion by a list of category IDs of products added to the cart.

Maximum number of IDs: 200.
productsArray of numbersRestrict promotion by a list of product IDs added to the cart.

Maximum number of IDs: 200.
attributesArray attributesRestrict promotion by a list of attribute values of products added to the cart.
combinationsArray combinationsRestrict promotion by a list of product combinations added to the cart.
shippingMethodsArray of stringsRestrict promotion by a list of shipping method IDs one of which must selected on the checkout, e.g. [6589-1709547151586"].

Requires "discountBase": "SHIPPING".

Maximum number of IDs: 100.
allbooleanInternal value (read-only).

attributes

Restrict the promotion of products with specific attribute values:

FieldTypeDescription
attributeIdnumberAttribute ID.
attributeValuesArray of stringsList of matching attribute values in products, for which the promotion should apply.

Total maximum number of attribute values across all attributes: 30.

combinations

Restrict promotion by specific product combinations:

FieldTypeDescription
productIdstringProduct ID.
combinationIdsArray of stringsProduct variation IDs for which the promotion should be applied.

Total maximum number of product variation IDs across all products: 100.
Language
Click Try It! to start a request and see the response here!