You can use order limits, discount coupons and saved product searches to define gifts with purchase.
Our example illustrates how to create a discount coupon that the customer can enter at checkout to receive a 100% discount on a selected product. You can inform the customer about it personally or add a functionality to the theme to display the discount code to the customer when a product has been added to the shopping cart.
Below you can see how to set up gifts with purchase step by step.
See also how to offer free products in your online store without order limit by using campaigns.
1. Creating a saved product search
First, create a saved product search that finds the gift with purchase.
2. Creating a discount coupon
Next, create a discount coupon to your online store, and target it at the product search you've just created.
3. Setting order limits
Finally, set the free gift's order quantity to 1 by using order limits.
Now the customer can enter the discount code at checkout and add 1 item of the defined product to the shopping card at a 100% discount.
4. Editing your store's theme (optional)
You can also add to your online store a functionality for displaying a notification about the discount code to customers when they add products to the shopping cart.
Below you can see a sample JavaScript code that uses Barebones' tools to display information about the discount in a modal window. The window displays a text fetched from a content page whose ID is 5, and the displayed contents are defined in the file helpers/modals/example.html.
The code is added to the afterAddProduct() hook used for initializing the shopping cart plugin, which can be found in the scripts/custom.js file if your theme is based on Barebones.
afterAddProduct: function ($buyForm) {
MCF.Loaders.hide($buyForm);
MCF.Theme.updateMiniCarts()
.then(function () {
MCF.Drawers.toggleByName('cart');
});
$.magnificPopup.open({
type: 'ajax',
items: {
src: '/interface/Helper?file=/helpers/modals/example&infopage=5'
}
}, 0);
},