We need to the ability to provide customers who purchase a particular product type (attribute type) a free type of gift with that product.

The products offered as a free gift are associate products of a configurable product. They need to be linked so that when this free gift is selected, it deducts from this SKU's quantity in inventory.

There are about 100 of these types of products that will be offered as a free gift - so ideally presenting the options in a dropdown menu would be preferred.

We've checked out about 10 'free gift extensions' now for Magento (and can't find any more) and none of them can do what we want or are wrote appallingly. They mostly auto add products at cart based on a rule like total amount. They're all limited in functionality and offer mininal to no flexibility.

I'm unable to add this as a configurable option due to the setup.

I can create them as a custom option but then they do not link up with the actual product SKU's and deduct from quantity in inventory.

Can anyone advise of an extension that can do this or the best way to implement this ability? It's looking more and more likely that we'll have to write our own extension to do this but find it hard to believe there would not be something out there that does this already.

  • 1
    A much easier way is to use a third party module like the Special Promotions Pro from Amasty (goo.gl/9WxbA4). It really works for our needs.
    – Ner
    Commented Apr 30, 2018 at 7:34
  • I would suggest you check out this extension Free Gift for this kind of functionality. Other features are also available, such as adding gift items to the customer’s cart automatically, choosing from multiple gift options, add a ‘gift’ banner.
    – Mohit Rane
    Commented May 31, 2021 at 10:22

2 Answers 2


The best way to achieve what you want is to create a custom module for this. You can follow below approach for this.

1) Create a product attribute for example: free_gift_sku with type as dropdown and enter sku of all the free gift products. Associate this attribute with each products

2) Now while creating the product, select the free_gift_sku value as the SKU of the product which is required to be added as free gift for that product.

3) Observe an event checkout_cart_product_add_after and get the details of the product added to the cart through quote_item. You will get all the details of the product which also includes SKU of the free gift product.

4) Now programmatically add the free gift product to the basket. You can define the logic of adding the product as per your requirement.

Please Note: The code for observer and adding product to basket programatically is different for Magento1.x and Magento2.x. Digging into the code/Googling it will help you out.

To save you some time, please check this thread to add product to cart programmatically in Magento2

Magento2 - How to add a product into cart programatically when checkout_cart_product_add_after is fired

Hope it helps

  • Good idea i will create a custom observer in Magento, thank you in advanced Commented May 24, 2016 at 10:11
  • sure, if you achieve this please post the code so it will be helpful for future readers.. All the best !!
    – Dexter
    Commented May 24, 2016 at 11:10

You Can Use this module https://github.com/gaiterjones/magento-buy-x-get-y-free

There are four sections to configure :

-- Buy X Get Y Free promotion.


Do not use this module if you already have extended the cart controller class with another module. e.g. if you are using a third party cart module, or an ajax cart add/remove product enhancer.

  • The README states: "The module works best for a free gift product that is a simple product without options. If you want to make your free gift product Y a configurable product i.e. a product with colours RED/BLACK/WHITE, then consider creating a simple product to represent the free gift i.e. "FREE RED/BLACK/WHITE GIFT - select colour at checkout" and then include a comments section at checkout to allow customer to specify the colour/size etc there." - that does explicitly not fulfil OPs requirement Commented May 25, 2016 at 8:59
  • @fschmengler right 100% your answer , any suggestions for helpful module ? Commented May 25, 2016 at 9:03
  • No, all modules that automatically add products based on a cart rule or when the cart contents changes will fail. Even if you can add incomplete configurable products and let the user configure them, they will be re-added as soon as the cart is evaluated again. Commented May 25, 2016 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.