Buy X get Y
General
When the promotion conditions are satisfied, the customer will receive n items for free. The discount is added automatically to the item in the basket during the specified timeframe. You can define the exact conditions, for example, if a customer buys a number of specified items, certain items are received free of charge.
Example
Buy two t-shirts and receive one pair of socks for free. For every sneaker in the basket, you receive one care product for free. Have an order total greater than 100€ and receive a pair of glasses for free
Required fields for Buy X get Y promotions
- Name
- Priority
- Schedule Date
- Customer buys
- Customer gets
Admin API
Parameter | Details |
---|---|
id READ-ONLY | String Promotion id |
version READ-ONLY | String Promotion version |
name | String Name of the promotion |
schedule | PromotionSchedule Time range when the promotion is active |
isActive | Boolean Promotion active flag |
shopId | String The list of shop ids where the promotion takes place |
companyId | String The list of company ids where the promotion takes place |
siblingPromotions | PromotionSiblingPromotions Sibling promotions allow/block other promotions from being used together with this one |
audiences | PromotionAudiences Audiences allow/block list. Use it to restrict promotions to specific customer groups |
effect | PromotionEffect The effect that will be applied if all conditions are satisfied |
globalConditions | PromotionGlobalCondition The list of conditions ('payload.*') that determines whether the promotion is applicable or not |
itemConditions | PromotionItemCondition The list conditions ('item.*') that determine whether promotion is applicable or not for a particular item |
priority | String Priority of the promotion |
additionalData | Object Additional data of the promotion. Can be legal text or some other info, that will be shown to customer |
tiers | PromotionTier The list of promotion tiers. Tiers must be sent in ascending order |
Create Buy X Get Y Promotion
let promotion = {
name: "MyPromotion",
schedule: {
from: "2023-05-10T10:00:00+01:00",
to: "2023-05-10T10:00:00+01:00"
},
isActive: true,
shopId: ["1000"],
companyId: "100",
effect: {
id: "buy_x_get_y",
additionalData: {
variant_ids: [1, 2],
max_count: 2
}
},
itemConditions: [
{
key: "mov_100",
condition: "item.color == \"yellow\""
}
]
};
let response = await client.apis.Promotions.createPromotion({}, {requestBody: promotion});
promotion = response.body;
console.log(promotion.id);
Update a Promotion
You can update promotion configuration such as schedule, effect, priority, etc.
Method Signature
let response = await client.apis.Promotions.updatePromotion({promotionId: promotionId}, {requestBody: promotion});
let promotion = response.body;
Example: Update a Promotion
let promotion = {
name: "MyPromotion",
};
let response = await client.apis.Promotions.createPromotion({promotionId: "65688b0987f54332106a579e"}, {requestBody: promotion});
promotion = response.body;
console.log(promotion.name);
Storefront API
Get Promotions
Retrieve active promotions with matching ID using GET v1/promotions
endpoint.
For details see the Storefront API Reference.
In the SCAYLE Panel
Create Buy X get Y promotion
For advanced & complex cases, you can use the advanced promotions view.
- Select the
Shop
where you want to create your promotion and go toPromotions > Buy X get Y
. - Enter a promotion Name.
- Select a Type: Automatic Discount or Buy X and Get Y.
- Select a Start date and End date.
- Enter a number for Priority. This determines the priority of the promotion in the case that there are multiple promotions active at the same time.
- Select whether the promotion should be combinable with other promotions.
- If selected, enter Combinable promotion IDs in the Allowlist or Blocklist.
- In Countries, select in which countries of the current shop the promotion should be valid.
- In Audiences, select for which customer audience the promotion should be valid.
- (Optional) In Combinable, select which promotions are allowed or blocked for combination.
- Enter further criteria based on the discount type.
- For type Buy X get Y, enter a list of variant IDs the customer can redeem.
- For type Automatic Discount, enter Discount type and Discount amount.
- Add at least one condition to the promotion. See conditions below.
- Click Save.