Set up "Buy X - Get Y" promotions

With promotions, you can set up Buy X - Get Y promotions in your store. For example, if customers add 3 any pizzas to the cart, they get a 100% discount on up to 2 drinks of their choice.

If you don't yet have an app for Ecwid API access, start with the following instructions.

Add products from category X to receive free products from category Y

Request example for a new promotion: "Add 3 pizzas to the cart and receive two free drinks"

POST /api/v3/STOREID/promotions
Host: app.ecwid.com
Content-Type: application/json
Authorization: Bearer secret_token

{
    "name": "Free drink for any 3 pizzas",
    "discountBase": "ITEM",
    "discountType": "PERCENT",
    "amount": 100,
    "enabled": true,
    "triggers": {
        "minProductQuantityInCart": 3,
        "categories": [862076252]
    },
    "targets": {
        "maxDiscountedProductQuantity": 2,
        "categories": [375620372]
    }
}

where:

  • "discountBase": "ITEM" states that the discount from the promotion only affects products defined in the targets object.

  • triggers object contains trigger conditions – a minimum of 3 products added to the cart from the category ID 862076252 (pizzas in our case).

  • targets object defines that the discount only applies to the first two products from category ID 375620372. Products from other categories or the third and later products from category ID 375620372 won't be affected by the discount (drinks in our case).

Change STOREID with your store ID, and the secret_token with the secret access token of your app.

Add product X and receive discount on product Y

Request example for a new promotion: "Buy muffin and get 50% discount on latte"

POST /api/v3/STOREID/promotions
Host: app.ecwid.com
Content-Type: application/json
Authorization: Bearer secret_token

{
    "name": "50% discount on latte",
    "discountBase": "ITEM",
    "discountType": "PERCENT",
    "amount": 50,
    "enabled": true,
    "triggers": {
        "minProductQuantityInCart": 1,
        "products": [102039482]
    },
    "targets": {
        "maxDiscountedProductQuantity": 1,
        "products": [236754267]
    }
}

where:

  • "discountBase": "ITEM" states that the discount from the promotion only affects products defined in the targets object.

  • triggers object contains trigger conditions – a minimum of 1 product ID 102039482 in the cart (muffin in our case).

  • targets object limits the discount only to product ID 236754267 (latte in our case).

Change STOREID with your store ID, and the secret_token with the secret access token of your app.

See also

API reference on creating promotions

Last updated

Was this helpful?