Use a Magento Coupon for a Free Gift – Coupon X Get Y Free

created July 20, 2011, last updated July 21, 2011.

closeThis post was last updated 11 years 5 months 3 days ago, some of the information contained here may no longer be actual and any referenced software versions may have been updated!

My BuyXGetYFree Magento extension has been updated with the ability to use any Magento coupon code to qualify for a free gift.

Simply configure a coupon as usual in Magento, set the coupon name i.e. “MYCOUPON1” but do not configure any coupon discount information. Then configure the name of the coupon in the Coupon section of the extension, and the ID of the free product, product Y. You should create a new or duplicate an existing product to create a unique product ID for your free gift.

When the customer enters the coupon code, the free product is added to the cart.

Use a Magento coupon for a free gift promotion
Use a Magento coupon for a free gift promotion








See the full extension page post for more information and to download. Thanks to Darren for the idea!


  1. Etta says:

    Great extension. I tried to test this with the coupon code and I get the following error:
    Error in BUYXGETYFREE configuration – Product Y is not unique across all BUY/SPEND/COUPON configs

    • PAJ says:

      Hi, have you also configured a Buy or Spend X get Y free product? You cannot share the same product Y across offers, it must be a unique product ID for each buy, spend or coupon offer. e.g. I have a Buy 2 tee shirts get one free offer, and I create a new simple product to represent the free tee shirt with the id of 101. Now I want to also do a get a free tee shirt with a coupon offer. I can’t use the same product id 101 as I used for the buy X offer, I have to create a new on, i.e. product id 102 and configure this as the Y product for the coupon offer.

      • Etta says:

        oh I see, ok I will around play with it tonight and let you know how that comes along. thanks

  2. Etta says:

    Hi, thanks for the fix. It worked well. I’m testing out the coupon feature as mentioned above. After entering the coupon at the frontend, Its giving me the message saying the coupon has been applied but there is no product is being added to the cart.
    I’m using version 1.4.2. could this be the issue?

    • PAJ says:

      Sent you an email. Remember you also have to configure the coupon in Magento Admin under Promotions > Shopping Cart Price Rules. Add a new rule, enable Specific Coupon and enter the name for your coupon and save. This coupon name you should then configure in the extension along with your product Y.

  3. Mick says:

    Hey, your extension is amazing and working as expected. However, i faced one problem. Can I disable “Spend X get Y free” feature for one specific product? It’s a gift card 🙂

    • PAJ says:

      I will need to develop an exclusion list for products you do not want to trigger the Spend X get Y function, will have a look at that for the next update.

  4. Mark says:

    Hello, great script. I have an issue with the ‘Buy X get Y free’ offer though, if I have multiple products ‘X’ i.e. around 300 and want to give the same free gift ‘Y’, this should work OK? When I add the list of product ID’s comma separated into the box for ‘X’, the script only adds the free gift ‘Y’ to the first product/ID and not any following products for some reason.

    • PAJ says:

      Each product X needs to have its own unique simple product Y, you cannot have products 1,2,3,4 etc in the X box and only one Y product id in the Y box, it would need to be 1,2,3,4 in X and 11,12,13,14 in Y. Obviously for 300 X products this is not pratical so you should look at putting the 300 X products into a category and then use the Buy Category X get Y free function.

      • Mark says:

        Thanks for the prompt reply, I’ve created a ‘Free Gift Products’ category which is not active/shown and your script now works great! Thanks for your help.

  5. Winnie says:

    Hello, I’m so grateful you’re offering this for free for small businesses like us. Unfortunately I’m running into problems and showing “A CouponXGetYFree Extension cart error was detected!”

    I must be doing something wrong, could you please assist at your free time? Thank you so much.

  6. Winnie says:

    I apologize the last post for being lack on details, I’m trying to set up a “Coupon X Get Y Free.” I’ve done everything as stated in instructions but I’m unsure which steps I may have messed up to cause that error message to pop up when I apply the coupon to my cart.

    • PAJ says:

      Hi, perhaps you can email me a screenshot of your coupon x configuration screen and I will have a look. email to extensions at gaiterjones dot com.

  7. surendra says:

    HI PAJ,

    I want to give 5 products as free gift products with one single coupon code. is it possible with your extension??
    Plz answer asap,

    Thanks in advance

    • PAJ says:

      Do you want to give five different products as free items? I would suggest creating a simple product to represent the free items and use this as the product Y, otherwise you can only provide 1 product y per product X with this module.

  8. Sampath says:

    whenever i go to cart after adding items it shows like even though the condition is met and also i tried adding more items but it results in following error message only.
    free gift is out of stock and cannot be added to the cart!
    Buy one more to qualify for the Free Gift

    Any help regarding this issue is highly appreciated,
    Thank you

    • PAJ says:

      If the extension says it cannot add the product because it is out of stock then the free product you have configured must be unsaleable, this is either due to it having no inventory, or because it is disabled or otherwise not saleable. Check the config of your Y product.

      • Sampath says:

        N0 Paj,
        I have cross checked all those things like inventory, status of the product and it’s saleable product.
        But still I’m getting this message in the cart:
        free gift is out of stock and cannot be added to the cart!
        BUY 2 GET 1 FREE is out of stock and cannot be added to the cart!
        Buy one more to qualify for the Free Gift

        I left with no idea about this, Could you please help me out.

  9. Robbe says:


    I installed your module and it’s working great.
    I’m working with use coupon get free gift.
    But when I use a onestepchekoutpage and i want to add a coupon code the gift isn’t added to the store cart ?

    But if i go the the cart, the cart gets updated and then the free gift is added.

    Can you point me in some direction on how to update the cart?
    Or how to refresh the cart contents manually. maybe in code so that the customers can’t see whats going on in the background.


  10. Esi says:


    Thanks for developing this extension.

    It works fine for one product ‘Y’. But what we want is to have multiple free gifts.

    So, we’ve added 2 product ‘Y’, comma seperated, but each time an item is being added to the cart, it says:”
    Buy one more to qualify for the free gift”

    Would you please help me us with that?


  11. Paul says:

    I am having trouble getting multiple coupon codes to work. It works if I enter them one at a time. But when I enter them as coupon1,coupon2 the first one works but not the second one. Which ever one I have first works, but not the second.

    Any help would be appreciated.


  12. Matt Breckenridge says:

    Your extensions has really helped me out, but I realized today that the free gift items that I’ve set up with the Coupon Code X Get Y Free have independent SKU’s that can be added to the cart by a customer regardless of whether or not they have input the code. This might not be a problem if I were able to simply hide the products in an invisible category, but my checkout cart specifically lists the SKU of each item that gets added, so the promo item SKU shows up.

    Is there anything you can suggest that I can do to prevent the independent SKU of the discounted product from being a problem for my store?

    Thanks very much for any suggestions you can offer.

    • PAJ says:

      The y product should not be visible in the shop and I would recommend modifying the cart template so that the sku is not shown for the y product, or any product with a 0 price.

  13. Roberto says:

    Hi, I can’t seem to make this extension work on my shop, it may be due to the amasty special promotion extension I installed – do you think having a custom set of promotions may create problems?
    Do you have any suggestions on how to fix that?

  14. Bijal Patel says:

    i use CE and have installed and configured exactly as mentioned. I get no errors and the coupon is applied successfully but the free product is not added to the cart / checkout review section.

    any ideas?

  15. Marié says:

    Hey Gaiter Jones 🙂
    Using your amazing module on our 2nd Magento store. Need to pick your brain about how to set up the promotion. In the previous version, we did it via the Shopping Cart Price Rule. Now it’s done via System > Configurations. I need to set up a rule, spend R1500 (X) and get a free gift (Y). We need it to only apply to a specific set of Categories, basically excluding all sales items. I have set up the Category X Get Y Free as well as the Spend X Get Y Free settings, separately and neither work. I am most probably setting this up incorrectly. Would really appreciate your assistance. Thanks so much 🙂

This site uses Akismet to reduce spam. Learn how your comment data is processed.