Free gift when buying specific items
Giving free gifts when customers buy certain items is a great idea in marketing. It makes customers happy and encourages them to make a purchase. When businesses give something extra for free, it makes customers feel like they're getting more for their money. This can build loyalty, making customers want to come back.
In this tutorial, you will learn how to run such a promotion using a real-life scenario. All customers who buy a T-Shirt will receive a free pair of socks.
We'll cover these areas:
- Use the Buy X get Y template in the SCAYLE Panel
- Communicate the promotion using Storefront API
- Apply the promotion in the Storefront API
- Validate the promotion in the Storefront API
Use the Buy X get Y template in the SCAYLE Panel
To create and run a buy x get y promotion, consult your SCAYLE Account Manager in order to activate the config sellable_for_free
. This config is deactivated by default for safety reasons, in order to avoid selling items for free by mistake.
To create a promotion using the Buy X get Y template:
- Select the Shop where you want to create your promotion. From the left menu, go to
Promotions > Buy X get Y
. - Click the
+ NEW BUY X GET Y
button. - In the Name field, type a name for the promotion. In our case, let’s name it “Free socks when buying a T-shirt”
- Priority: enter the priority of the promotion compared to others. Enter 0 in this field, as no other promotions are currently active.
- Start date: enter the date and time when the promotion starts running.
- End date: enter the date and time when the promotion becomes inactive.
- In the Customer Buy section: We need to limit the condition, to be only applicable, when the customer buys at least one item of the category Shirts Click
Selected Categories
and select the Shirts category. We also set the minimum quantity of products to be purchased to 1.
Once the promotion has been successfully created, the promotion ID appears in the breadcrumb trail. Save the promotionId to use in further steps.
Communicate the promotion using Storefront API
We want to communicate the promotion during its runtime, specifically to the customers buying shirts. To do so, you can add a badge to products in the category “Shirts”.
Apply the promotion in the Storefront API
To apply the promotion, use the Storedfront API.
Send the promotionId within the request body of the POST (Add an item to a basket) /baskets/:basketId/items
method of the Storefront API.
This would give us a request body like this:
{
"variantId": 12,
"quantity": 1,
"promotionId": "65438f563a404c7e45779f17"
}
Validate the promotion in the Storefront API
In case a customer opens the basket view, you want to communicate the discounted prices, however, only, if the promotion overall is valid. For these cases you use the GET /baskets/:id/items
endpoint. The response will tell you, whether the promotions within the basket are valid.
Summary
Key takeaways from this tutorial. You should now be able to:
- create Buy X get Y promotions in the SCAYLE Panel using the buy_x_get_y effect
- specify which conditions must be met, so that a customer is eligible for a free gift
- use the Storefront API basket endpoint to find out whether the promotion conditions are valid