FREE Magento Extension Buy One Get One Free

created March 4, 2011, last updated June 22, 2015.

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

Magento BuyXGetYFree Extension

FREE Magento Extension Buy One Get One Free

A common requirement for an eCommerce store is the Buy X Get Y free sales promotion, where a bonus product Y is offered if the customer buys a quantity of product X or the Spend X Get Y Free scenario where a bonus product Y is offered when the customer spends X amount on a single order.

Free Magento Extension for Magento eCommerce Stores

This free magento extension provides Buy X Get Y, Spend X get Y, use Coupon X get Y and buy from Category X get Y functionality for Magento eCommerce stores.

Tested with CE 1.3 – 1.9 and EE 1.x

The module code is now pretty stable and has been implemented in many Magento stores.

Download Free Magento Extension

Download the latest version of this free magento extension / module via Github here

Try out the extension at my development store here

Magento Buy one Get One Free Example
Magento Buy one Get One Free Example



If you use this free magento extension be sure to update to the latest version, latest source code will always be available at the github.

*  0.34 – First beta release. 05.03.2011
*  0.40 – Corrected problem rendering cart in Magento versions 1.4+
*  0.41 – Added logic to allow a maximum product X limit for product Y i.e. buy 5 get 1 free, buy 10 get 2 free etc.
*  0.42 – 01.07.2011  Added control to ensure product Y is unique across all offers to prevent a nasty cart loop
*  0.43 – 20.07.2011  Developed Coupon X get Y Free, get a free gift with a coupon.
*  0.46 – 22.07.2011  Bug fixes and coupon dev.
*  0.50 – 04.08.2011  Developed Category X get Y Free, get a free gift, bonus product when you buy a product that is a member of a specific category.
*  0.51 – 09.08.2011  Bug fixes.
*  0.53 – 15.08.2011  Developed customer group check for Spend X
*  0.53 – 25.08.2011 Tested with Magento CE
*  0.56 – 21.10.2011 Enhance coupon X function.
*  0.57 – 02.11.2011 Enhanced Spend X to function in multi currency store.
*  0.59 – 13.01.2012 Bug Fixes
*  0.61 – 08.03.2012 Fixed coupon function to ignore coupon case. Added product exclusion to Spend X function.
* 0.63 – 21.03.2012 Added minimum X quantity required for Category X
improved excluded products logic for Spend X. Admin updates.
* 0.65 – 22.03.2012 Translation improvements.
* 0.66  – 06.07.2012 Bug Fixes in Category X function
* 0.70 – 16.11.2012 0.70 – Changes to indexAction to improve functionality with other modules extending cartcontroller
* 0.71 – 18.11.2013 Added max limit to allow various Y products in SPEND X



Buy category X get Y free – done (v0.50). Many thanks to CC LLC for the development incentive.
Spend X, offer choice of product
Use a coupon for a free gift – done (v0.46).
Restrict offers to customer groups. Done for Spend X in v0.53.
Specify cart amount required for Coupon X (done v0.55)
Exclude specific products for Spend X (done v0.61)
Minimum X quantity for Category X (done v0.63)

If you have a requirement for a specific feature let me know and I will add it to the wishlist.


Works with simple and configurable products ( as product X), or categories containing product X.
Prompts customers that a bonus product is available
Multiple offers configurable
Offer details customisable in admin
Manage stock of offer products – send alert emails, low stock, errors etc.
Use coupons for free gift promotions.
Use category to define products that qualify for free/bonus product.
Restrict offers based on customer groups
Can work with AheadWorks products, Ajax Cart, Mobile Theme


Extract the extension and copy the files to the /app folder of your magento installation. Refresh your cache, log out of admin and back in again.


Configure the extension under System>Configuration>My Extensions see below for examples. There are four sections to configure, one for each type of BUYXGETYFREE promotion, BUY X, SPEND X, CATEGORY X and COUPON X.


Buy product X get, product Y free, discounted.


Spend amount X, get product Y free, discounted.


Use coupon X get product Y free, discounted.


Buy products that belong to a specific category X, get product Y free, discounted. Allows you to step product X to provide for example buy 3 get 1 free, buy 6 get 2 free etc.

You must create a new simple product to represent your free gift product (product Y), or duplicate an existing product. Product Y must have a unique ID across all configs, buy, spend and coupon. It must be saleable, should be hidden from your catalog search and have a zero price.

If you want to provide the same product Y free or discounted for various product X’s you must duplicate product Y for each offer so that each product Y has a unique ID number.

If you want to give a bonus product for multiple product X’s either use an existing category that the X products are members of, or create a dummy category, i.e. BuyXGetYFree that is not enabled/visible. Then add the X products to this category. Specify the ID number of the offer category in the extension configuration.

The extension 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.

To configure the extension for use with a coupon, first configure the coupon under Admin->Promotions. Configure the name of the coupon but do not apply any discount info, conditions or actions, i.e. in effect the coupon does nothing. Under the Coupon X configuration section of the extension, define product Y, the free or discounted product and the coupon code of the configured coupon. You can also configure a minimum cart total required for this coupon. Test the extension by applying the coupon to the cart, product Y should then be added.

Consider modifying your theme so that products that have a zero price have the quantity selection box disabled or removed in the cart or during the checkout process.

Test out the extension at my development store here

Here are some examples of functionality.

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


Buy One Get One Free Example
Buy One Get One Free Example
Advise customer of bonus offer
Advise customer of bonus offer – prompt to buy one more.
Buy One Get One Free with configurable products example
Buy One Get One Free with configurable products example
Mixed Offer
Mixed Offer free products based on product quantity ordered and order value.
Example Extension Configuration for BuyXGetYFree
Example Configuration for BuyXGetYFree
Example Configuration for Spend X Get Y Free
Example Configuration for Spend X Get Y Free
Configure the coupon under promotions
Configure the coupon under promotions
Example configuration for Coupon
Example configuration for Coupon X get Y free promotion.



  1. David says:

    Can you tell me if it does allow to buy ANY x from a specific category (let’s say Black) and then you can get/add ANY y from another category (let’s say White)? Thx 😉

    • PAJ says:

      Do you mean for example a configurable product with multiple categories, i.e. T Shirts in multiple colours and the offer is buy 2 BLACK T shirts and get a WHITE T shirt free? Then at the moment the extension doesn’t differentiate between the colours of the T Shirts, it would give you the free T Shirt whether you bought 2 Black Shirts, 2 White Shirts or 1 Black and 1 White. The free Y product is easy to configure because you simply create a new, or duplicate an existing product, give it a zero price and define it as the Free Y product.

      • David says:

        Have a client who’s selling Nail Wraps that are divided in different colour categories and what they would like to achieve is for their customers to be able to choose any 6 of any colour and then you get any 4 free (mixed) from a specific category that we could call “FREE”. Is this something achievable with your script? Thanks again for your help… 😉

      • PAJ says:

        The script will do what you want if the Nail Wrap is a configurable product associated with the simple products that make up the various colours, i.e. Nail Wrap with 40 colours, 40 simple products associated with one configurable product.

        You would set the product X id to the configurable product ID of the wraps, For the 4 free products you would simply create a new simple product with a zero price called “buy 6 get 4 free” etc. and configure this as product Y, and set the qty to 6 to add the free product when 6 or more of the Wraps are in the cart.

        If the wraps are simple products with each colour as a seperate product then it would need some developing to achieve what you want I think in order to check the cart for this products SKU and total them up.

  2. Half says:

    can anyone tell me, does it work on magento EE?
    currently im using CE, but later on, i’ll change into EE.. will it works on EE?
    im just wondering

    • PAJ says:

      None of my extensions have been tested on EE as I don’t have a copy! Unless you want to test it yourself you should assume it will not work with the EE version.

    • PAJ says:

      You create a simple product Y that the customer will receive when they spend X that has a zero price. Then configure the extension with the amount the customer must spend X, and the ID of the product they will receive free Y. When the total in the cart is greater than X, product Y will be added. Or perhaps I have not understood your question 100%!

  3. Martin says:

    the extention seems to be installed ok.
    in the admin i can confige the buy X get Y free, but in the frontend it does not show.
    also i don’t receive an error email

  4. Mike says:

    Looks great! Thanks for offering it. One question: What happens if the purchaser deletes the other item from the cart? Does the free item stay?

    • PAJ says:

      Short answer Yes, long answer, free gift Y will always be removed when it no longer qualifies as a free gift. So in the Buy X get Y free scenario where a customer has already put X in the cart and Y has been added too, and then removes X, Y will also be removed as it no longer qualifies as a free item. Similarly with the spend X get Y free scenario, once the cart value drops below that defined to get Y free, any existing free products in the cart will be removed. Similarly if the customer deletes product Y from the cart it will automatically be re-added. You can also modify your template to remove the delete button for products with a zero value so that it is not possible to remove free items from the cart manually.

  5. Mike says:

    Hi. I just tried emailing you, but the email address seems to be invalid.

    I have installed your extension in my Magento 1.4.2 cart. The cart also has the aheadWorks SARP (Subscriptions) extension installed (not that I think it matters, but it may)

    I set up the buy x, get y free and it correctly shows up in the cart (though the cart still says ‘1 Item’)

    When I go to the checkout page, and get down to order review, I only see the original item, not the free one. But again, if I click on the cart, it shows both of the items still (only with the ‘1 Item in Cart’ message)
    Any thoughts? Thanks!

    P.S. I’d gladly donate some money for this extension if I can get it to work.

  6. Ahmad Iqbal says:


    I’m using Magento Enterprise Edition and i have installed the extension and working fine up when select product and the free item is there, but when i need to checkout to the next page, the free item is missing. I have applied updated CardController.php as per above. But it still doest work after i flush the magento Cache and also remove the files in cache folder.

    I’ll be happy to give you my Magento EE back-end details and FTP access if you like to see what is the issue.

    Thank you.

    • PAJ says:

      Yes, I would like to see what is going on, I think this just has to do with changes to the cartcontroller and should be easy enought to fix.

      • Ahmad Iqbal says:

        Can i get your email for me to provide you with the EE details. Or replying my email as given to you.

        Thank you very much!

  7. Gnomezero says:

    Hi PAJ,

    Great extension! But the last but is still in
    I did what you said (replace, flush, test) and no free product appear in checkout page in order view (customer side & backoffice).

    It will be great if you had a patch. Great extensions btw!

  8. shaun says:

    Will the Spend X get Y for free work if the user is able to select from a number of free items?
    e.g. spend over $75 and choose one of three free gifts on offer.

    • PAJ says:

      At the moment no, you can have multiple product Y added to the cart when the spend is greater than X but the option to choose from a range of product Y would need to be developed. Its an interesting idea and should not be too difficult to achieve. I will add it to the wishlist.

      • Don says:

        Your extensions@ email is bouncing. This is not working with and presumably Aheadworks Ajax Cart Pro. If you want to play around with mine, let me know via email.

  9. Don says:

    Actually, I messed up the settings a bit, but – with or without Ajax Cart Pro enabled, I get “free gift is out of stock and cannot be added to the cart!”.

    Free Item = $0.00, In stock with 1000 quantity and backorders allowed… but always shows out of stock.

    • PAJ says:

      I need to fix that email address, can take a look for you, will drop you an email. Cart pro extends the cart controller too so will require some customisation.

  10. Hi,

    A great idea for an add on to promotions.

    Have you considered for future release being able to apply it to discount codes. The reason for this is that you can then target who gets to benefit from the promo – as it stands anyone who adds £x amount to their basket would get a free product. Which you wouldn’t always want to do.

    For example I might send out a newsletter promoting to my client, if you spend £30, or more – enter this code OFFER-01 and get a free gift. This is an intensive to customers but it’s not if anyone gets the same benefit.


    • PAJ says:

      Hi Darren, great idea. I was doing some work last week on coupon codes, I think it should be relatively “easy” to incorporate the free gift with the coupon code. Will have a look into it.

    • PAJ says:

      Rattled something together today, you can now use a coupon as the qualifier for a free gift or promotion / discounted item.

  11. Bruno says:

    Hello Paj,
    awesome extension! Thank you! Ive a question: Is it possible to ad 2 or 3 X Products to the cart and it does multiply automatically the Y Product??
    Thanks for your reply.

    • PAJ says:

      I have just updated the extension to work with categories. Download the new version and give it a try. You can use an existing category, or create a dummy BuyXGetYFree category that is disabled and add your product X’s to this category.

      • PAJ says:

        What do you mean exactly, give me an example. The extension can multiply Y if for example there are 5 Products from category X in the cart that qualify for free products, then there will be 5 X product Y free in the cart too.

      • Bruno says:

        i mean eg:

        put 5 shoes (all the same, same id number) into the cart and put automatically 5 shoe lacers for free in the cart as well

      • PAJ says:

        Yes the category X option will do that, put the shoes into the same category and specify the category id and the id number for the free laces into the config. When 5 X Shoes (products in category X) are in the cart, the customer will get 5 X Laces (product Y), up to a maximum that you can specify in the extension settings too.

      • Bruno says:

        Well i ve tried it but it still does not multiply! Another example i have shoe (id:210) and ill put 5 of thoes into then cart it should put 5 free Y Products into the cart as well but it only puts one! Any idea what i do wrong??

      • PAJ says:

        In the extension config you have to set “Max Number of Product Y allowed in cart” to 5, otherwise it defaults to 1.

  12. Ryan says:

    Installed extension but can’t see any options in the configuration menu on the backend of magento. I refreshed cache and logged out/in but nothing is there. Am I missing something? Running Magento 1.3

    • PAJ says:

      I have been mostly developing this for Magento 1.4+ and haven’t tested it under 1.3 for a while. I will have a look and get back to you.

      • Ryan says:

        I’m an idiot. I was putting a folder in the wrong spot. Got it running now. Thank you so much for the quick reply. You don’t see that often in the Magento world.

  13. Cam says:

    hi there. great extention. Is there a way to add your extention to choose which customer groups get the X Y discount. I currently wholesale as well and dont want the wholesalers getting free gift. Using spend X get Y

  14. saravanan says:

    hi, I try install buy x get y free extension to my magento 1.5 version. I did install the extension, copy the extension app folder to my magento store app folder.
    Refreshed my magento cache.
    Logout from admin, and logged in again. To configure I clicked system > configure but I can’t see any Buy X Get Y Free. any help…

  15. Lim says:

    great extension but it failed to add in Y when X was config product so I added all the associated products 1 by 1 and it works. However, same issue with Bruno, when I increase the qty of X, Y still remain at 1. I tested with buy X (1 unit) and get Y (1 unit) free but when I add in more X, no change of Y qty. Followed the step and changed/tested “Max X Qty…..” in setting, same results.

  16. ivan says:

    I have already tested it in version 1.5 and enterprise editions.
    1.According to my test, if we set up Buy X Get Y Free in the backstage,
    the problem is: when the customers have cancelled their goods, the free gift is still in the shopping cart.
    For Category X Get Y Free, there is no such problem.
    2.If we set up Extension Settings in the backstage , then set Allow duplicate product Y to be
    the problem is: when customers buy 5 pieces of goods, they can only get 1 free gift. In fact, we are intended to send them 5 free gifts. (buy 1 get 1)

    Could you please send a copy of fixed BUG to my e-mail?Thanks!

    • PAJ says:

      If you want to give the customer 5 free gifts for 5 product X then set the minimum product X required to 5, and create a new product Y called something like “5 Free Products” and set this as the new product Y.

      I don’t have a fix for the other bug you mention, although a workaround is to leave product X and Y configured and set the required number of product X to infinity, i.e. 99999 then any existing product Y’s for that offer will be removed from a customers cart when they next login.

      The Allow Duplicate Y option has no effect I used it to do some debugging and it will be removed in the next update.

      Hope that helps!

  17. Andrew says:

    I have installed this module in my client’s store. What they are really trying to achieve is this:

    Spend X Get Y Free but only if customer has specific Coupon

    I was hoping that this functionality would be in this module. Any chance you would consider adding? How difficult would it be? Thanks.

    • PAJ says:

      Probably better to implement as Coupon X Get Y Free IF cart value is greater than Z. This was implemented in v0.55.

  18. Fei says:

    Hello, that’s really a great module, thanks for your effort.
    I would like to ask 2 questions about the spend X get Y free:
    1. Is it possible to compare X with the payment (after the shopping cart rule discount) instead of the “cart total”?

    2. It seems not work with multi-currency… can you guide me how to get it work? Thank you.

    • PAJ says:

      Hi, can you explain a bit more what the problem with multi currency is. I don’t yet have any experience with a multi currency Magento store.

  19. Fei says:

    Yes, for example, my base currency is HKD, and I have set that spend HKD $500 get a free gift. So if a customer buy a product for HKD $600, then he should get the gift.

    However, if he changed the currency in frontend to USD, then original HKD$600 product would become USD$76.92, then the module decided not to give him the gift.

    I have tried to changed it return to HKD, then the gift appear again. So I think the problem is due to the rules haven’t consider about the change of currency.

    That’s it and please also give me a suggestion of first Q, thank you.

    • PAJ says:

      Spend X now functions correctly in a multi currency store where the cart X value is set based on the stores base currency.

  20. Martin says:

    Very nice working on CE 1.5.1 out of the box.

    Not sure if it is possible:
    Create multiple rules ex:
    Buy products 223 and get product 2223 free
    Buy product 224 and get product 2224 free
    Same with coupon codes, to have 3 codes that will give 3 different free samples.

    • PAJ says:

      For multiple offers you need to comma seperate the config, so in your example you would configure multiple product x as 223,224 and the free y products as 2223,2224. Same goes for coupons, comma seperate the coupons Coupon1,Coupon2,Coupon3

      hope that helps.

    • PAJ says:

      You need to make sure your free product Y is saleable, that means it must be associated correctly with a store, enabled, and have inventory.

    • Rob says:

      Hello. I installed the extension, all configurations. But when I enter the coupon it s shows that product is out of stock. Any solutions? thank you.

      I get the same thing. I can purchase the free item but when I try the coupon it says it is “out of stock and cannot be added to the cart.” Any fix? Thanks so much!

      • Rob says:

        I get the same thing. I can purchase the free item but when I try the coupon it says it is “out of stock and cannot be added to the cart.” Any fix? Thanks so much!

        Found the problem: I was using SKU instead of product ID. Inputted the correct product ID and it works perfectly. Thank you so much! Sorry for the user error. :>

      • PAJ says:

        Glad it is working for you, will update the documentation so that it is clearer that a product id number should be used.

  21. Ricardo says:

    Hello again, my product Y is saleable, enabled and have inventory. My product is called 987. My magento version is 1.4.2. what can I do to make it work? Thank you

  22. Martin says:

    Can we do buy X get X free? Basically same item is added to the card.
    When trying to add same ID for product Y i am getting message:
    Error in Buy X configuration – Product Y is not unique across all extension settings.

    • PAJ says:

      Simply turn product X into product Y by duplicating it. Give it a new SKU – FREE-PRODUCT-X and a zero price (if its free), make sure it is saleable, i.e. enabled and has inventory, and use this as your product Y in the configuration.

  23. James says:

    Just a quick question regarding functionality, because I’m confusing myself – does this extension provide the functionality to run a Buy X get Y free promotion based on all items from a certain category?

    For example, if a customer buys a certain number of items from category Z, they’ll get the cheapest for free. Sorry if my question does not make sense.

  24. Christian says:


    i tryed your extension and it is realy cool. But for me it does not work in the Internet explorer. Are you aware of the bug?
    On all other browsers (Firefox, Safari, Chrome) the extension works perferktly.

    Is this only on my system, if yes, can you help me fix it?

    I’m currently using version 0.53.

    Greets Christian

    • PAJ says:

      The code in this module simply extends the cart controller functionality, there is no html code or anything else that is browser specific. so I am not sure exactly where your problem lies and I have not experienced any browser compatibility problems using this module before.

  25. Elvar says:

    Hello… Can I specify FREE product as saleable but NOT VISIBLE INDIVIDUALLY in catalog?

    This is a must as I want to give away a free product which is already in my store so I will create a duplicate with 0 as price but not visible aside original one.

    • PAJ says:

      Yes, set the product so that it does not appear anywhere in the catalogue, otherwise people can find it and order it!

  26. Elvis says:

    Yes I installed and it works out of the box. There is a little problem – If my gifts are not visible in the catalog individually then a a href link on product gift from shopping cart will lead to 404 page. Links need to be removed from this gift products…

    Also, observer does not add the product in cart automatically but only when customer loads the shopping cart view (this is a problem when store are using one step checkout apps or even ajax add to cart from catalog).

    And finally – CategoryX Get Y product have some issue with the quantities of the gift products. There is a only one gift product defined and maximum quantity set to 2. If you add 2 different products from CategoryX you will get those 2 gift products. But if you add only one customer can update shopping cart gift product with quantity of 2.

  27. Elvis says:

    Thanks man!

    You have an typo in
    line 639 — maxQtyProductY — need to be maxQtyProductY

    Also, there is an system.log warning for core tax class:

    Warning: Division by zero in /app/code/core/Mage/Tax/Model/Sales/Total/Quote/Tax.php on line 388

    meaning the price = 0 for free product calls this tax functions.. Can we somehow skip this?

  28. PAJ says:

    Thanks for spotting that typo! With the division by zero problem, surely this should be caught by the tax class? Will need to look into that, where are you seeing the error logged?

  29. Peter says:


    I get: Fatal error: Class ‘PAJ_BuyXGetYFree_Helper_Data’ not found /public_html/app/Mage.php on line 520

    I’m using magento

    Can you help me please? Thank you!

    • PAJ says:

      I cannot reproduce this error with a 1.4.x install, perhaps you can ensure that you have refreshed the Magento cache and that the module code has been copied to the correct locations.

      • Peter says:

        The mistake was on my side. Something was wrong with my magento installation. Sorry about that.
        Did you think about adding a function to make a promotion active from date to date? So that you can set up a promotion for the future and don’t need to enable and disable it manually? Anyway great extension!

  30. Josh says:

    This extension works great on my cart page, but I can’t seem to get it to work on the onestepcheckout page when I add the promo to add a product

    • PAJ says:

      Hi, thanks for the feedback, I have not tested the extension with the one step checkout feature in Magento so we have to assume that it’s not compatible yet with one step checkout. I will need to look into it sometime.

      • Josh says:

        Is this something you can look into soon? Or maybe steer me into a direction where I can get it to work? Any ideas?

  31. Haney says:

    Great extension… The only problem is, its duplicating the alert messages. i.e. if I add a product into the cart, it will say:
    Buy one more Volor Alitemoui to qualify for a free gift!
    But if I update the quantity to 2 and press ‘Update Shopping Cart’ it will show:
    Buy one more Volor Alitemoui to qualify for a free gift!
    Your free gift has been added to your cart.

    Basically, it doesn’t remove the previous message and shows the next one on next line. Any idea how to fix this?

    • PAJ says:

      The free product (product Y) is a zero price dummy simple product that represents the actual product you want to give as a gift or discounted. So if you want to make the free product 50% off instead of free, simply give the simple product a price that is 50% off the normal price instead of a zero price.

  32. Pierre says:

    This is a great extension !
    I’m searching for a magento extension that does this:
    – a reduction coupon
    – when people order by 4, they get 1 (or 25%); so if people by 10 they will get 2 free
    – based on category, not products (so people get 2 products of category A, and 2other products from category B, they get the 1 free)

    • PAJ says:

      Hi, the Category X get Y free function in this extension would almost do what you want, I would have to develop a minimum X quantity check to allow the Y product to be added when a certain number of the X product (4 or 10) were in the cart, at the moment its just buy one from category X get 1 free. The Y products are represented by “dummy” simple products, the extension does not let the customer specify which free product they want, you can use a comment field at checkout to ask the customer to specify what they want if you wanted to provide multiple free products. If you want to simply give a discount with a coupon then the default magento coupon system will do that.

  33. Paul says:

    First of all, I like this contri very much!!!

    I want to use the, Buy X, get Y option.
    But from 1 category i gave 6 ID’s
    When the total is 6, the customer gets Y free.
    That works, but only if 6 items of 1 ID is in the cart, but i want the total to be 6.
    I want a total of 6, from differnt ID’s.
    So X = ID 17,18,19,20,21,22
    So that can be, 6×17 or 2×17, 2×18, 1×19, 1×20
    But i can’t get that to work, only if there a 6×17, or 6×17 etc.

    I hope you understand what i mean.

    Thanks in advance,


    • PAJ says:

      Hi Paul, what you have described is the correct behaviour for the Buy X get Y free function. when you have multiple product X’s that will qualify for a free product Y it is better to use the Category X function of this module and put all your X products into a new dummy category that is not visible in the webshop. Then configure the extension with Category X get Y free, specify the ID number of your new category and your product Y id. At the moment I think category X will automatically add product Y to the cart when one or more products from category X are present. If you want product Y to be added when 6 or more products from category X are present I will need to add that option into the code.

  34. Paul says:

    Thanks PAJ for your quick reply!

    I did try to use the category option, but indeed i can’t configure the amount, 6 in my case.

    If its possible to add that option, that would be great!


    • PAJ says:

      Hi, download v0.63 and install. You can now specify the quantity of products in Category X that will qualify for Product Y, i.e. in your case specify 6. Let me know how you get on.

      • Paul says:


        Works great!

        Still few comments 😉

        It would be nice to have a text in the shopping car that would say: Still add 2 more to get … free, or something.

        And when i 5 items in the cart, no free gift, good.
        When i add the sixth one, automaticly the free product, great, but when i change the total in the shopping cart back to 5, the free product keeps in the cart, in stead of disappear.

        And last, when i add 6, i get a free product, but when i add 12 , i should get 2 free products etc, that doesn’t seem to work.

        But, great contri.
        Thank you very much, you should think about a Donate button!

        If interested can give you a Dutch translation….


  35. Sebastian says:

    im using your buy X get Y free extension for magento.
    It works fine in the shopping cart.
    But i installed onestepcheckout of mage-world. In the checkout form your coupons dont work, other coupons are working well in the checkout.

    so i think its like a combination of your extension and the onestepcheckout.
    Do you know how i can solve this problem?
    thank you very much
    best regards

    • PAJ says:

      There is a good chance that both extensions are trying to extend the same core magento class which will cause problems in either or both extensions if they run together. This would require development of perhaps both extensions to get them to work happily together.

  36. Homero says:


    Very interesting and useful this extension. I wonder if it change any file from the “core” of Magento, and suffice it to uninstall delete the directories created on the server.

    Are there any known problems for version 1.5 of Magento, I should check before installing?

    Thank you.


    • PAJ says:

      This module makes no changes to core magento code. To remove it simply remove all files associated with the module and refresh your magento cache. There are no problems I know of using it with v1.5.

      • Homero says:

        Hi PAJ

        Thanks, I have already installed the module, and is working properly. I will suggest this extension in Magento forums and mailing lists that I sign here in Brasil.: -)
        To translate the messages to the Portuguese, I can directly change the file CartController.php? For example, the phrase “Your free gift has Been added to your cart” always appears in English, even changing the CSS.
        It seems that the phrase is composed of CartController.php, and not read the CSS.
        Can I change these phrases CartController.php directly, without affecting the operation of the extension?

        Thank you.


      • PAJ says:

        You can edit the english text in the cartcontroller.php if you want to. If you send me the translations I can include them in the locale files for other users.

    • Homero says:

      Hi PAJ

      I have a problem with the payment gateway used here in Brazil, called PagSeguro. Your extension to Spend X Get Y Free worked perfectly, but as a product is priced zero (0), the payment gateway returns the error message.

      The system does not support the product values ​​to zero. Any idea how to get around this problem with Magento? Any help is welcome. 🙂

      Thank you.


      • PAJ says:

        I would speak to the payment gateway people first, there must be a way to allow zero priced products. The other alternative would be to make the free product 0.01c instead of zero perhaps?

  37. Homero says:

    Hi PAJ

    Thanks for the help. I got in touch with the support of the gateway, but they are “big” and we do not, and they usually dont change their structures without good reason ($$$ :-).
    Place a small amount is an alternative, such as 0.01, but I would like to appear no value to the user.
    You would know a way to make this change in the Magento system, or your extension?
    A code that checks if the value is zero, and moved to, 0.01?

    Thank you.


    • PAJ says:

      Simply download it, extract the files, copy the contents of the extracted /app folder to your magento store /app folder, refresh your Magento cache and configure the extension! If you need any more help let me know.

  38. Sankar says:

    Hi Paj,
    I need help for Buy 1 category item and get 1 another category item free.
    Can you help me how to make this rule for shopping cart price rule.


  39. Sankar says:

    and also when i going to change x value like 2 means y value also 2 time free.

    Buy 1 Shirt get 1 Tie Free on Selective Styles

    Product QTY Discount QTY
    Shirt 1 Tie 1
    Shirt 2 Tie 2
    Shirt 3 Tie 3
    Shirt 4 Tie 4
    Shirt 5 Tie 5
    Shirt + Tie (1+1)2 Tie 1

    How to make above rule. In single rule make this logic.


    • PAJ says:

      Hi, you configure the buy x get y free rules for this module in the modules configuration settings and not under the cart price rules. For you example make sure all the Shirts (product x) are in the same category (caregory x) and create a new product to represent the free tie (product y). Then create a category X rule in the module to give one or more product y – ties, for each product in your category x – shirts.

  40. CG says:

    Hi, thanks for this extension, unfortunately I am getting “A SpendXGetYFree Extension cart error was detected!” when I reach the free gift total. Any ideas?


    • PAJ says:

      This usually occurs when product Y is not saleable. Make sure the product you created for the free product Y has inventory and is enabled. Also ensure that product Y has no options configured this will cause an error in the extension.

      • CG says:

        Hi, yes, it’s enabled and there is inventory. I have tried it with a few different products and I get the error each time.

      • CG says:

        Thank you for the help you gave me earlier. It is now fixed, and as expected was my error not yours. This has saved me a lot of headaches so thanks again.

  41. Gaurav says:


    I need to integrate buy one get one free .
    In other words want the same product free with purchase of the same one product.

    is it possible through this extension if yes then how please guide.

    Kind regards,

    • PAJ says:

      It’s very simple. Create a dummy product for your free product with a zero price (if it is going to be free), enable the product and give it inventory but hide it from your catalog. Take a note of the id number of this new dummy product, this is your product Y. Take a note of the ID number of the product you want to give the free gift (product Y) with, this is your product X. Goto the extension config and configure Buy X Get Y free with your product X and Y id numbers and thats it. When product X is added to the cart, product Y will be added too.

  42. sharon says:

    I tried the extension on the developing site (test site), followed all guideline, but the free gift doesn’t auto add to the cart. I am using magento wondering if this extension is compatible with it.


  43. Phil Clark says:

    I have configured the Coupon X get Y Free according to the very BRIEF instructions, however it is not working.

    Please advise if you need screen short or how you can help me get this done.

    Thank you!

    • PAJ says:

      Have you configured the coupon in Magento ? promotions > shopping cart price rules correctly? You can configure this and test it manually, then add the coupon name to the BuyX config.

  44. John says:

    I get an 404 error on the admin pages for this extension.
    There is no more info available. A 404 error and the system->configuration
    navigation on the left site is gone.

    Are there more experiences with this and what could be the reason/solution?


  45. Judi says:

    Hi , I have .54 installed on 1.5. I have everything working for buy X get Y free for one product at a time. But I cannot get two different products to work to work at the same time.
    Product X : 2183, 623
    Product Y: 2737,2738
    All products are saleable and in stock. They work if I do one at a time but not with the commas.

    What am I missing?

    • PAJ says:

      Hi, you need to also comma seperate the values in the “Minimum quantity of product X required to qualify for Product Y” input box, so if both offers are valid when one product X is in the cart you would configure this as “1,1” (without the quotes!). Do this and then both offers will work as expected.

  46. Wuz says:

    When using “Coupon X Get Y Free” functionality we want to have multiple promo codes adding the same free gift. At the moment only the first item in the comma delimited list is working. Could you let me know what I am doing wrong?


    • PAJ says:

      Hi, the comma seperated lists must match e.g.

      product y : 101,102,103
      coupon: coupon1,coupon2,coupon3

      This will not work –
      product y : 101
      coupon, coupon1,coupon2,coupon3

      The other problem you will experience is that product Y must be unique, so if you are giving away the same product for different coupons you must duplicate your product y dummy free gift product for each coupon, so that the rule looks like above

      producty 101,102,103…
      coupon coupon1,coupon2,coupon3

      Where 101,102,103 are dummy product ids representing the same free gift (or different gifts if required.)

      Hope that helps.

  47. Hi,
    Installed your extension, flushed cache, configured buy 3, get 1 for free. (get 4 pay 3) Checked the product ID’s, tried other combinations but nothing happens.
    Magento version 1.6.2. Any tips?
    Greetz, Petra

  48. Robert says:

    I’m not real sure if this has been asked:

    Will this extension allow my customers to buy 1 tshirt that comes in different colors and sizes for one price… And then get 1 tshirt that also comes in different colors and sizes and (potentially a lesser price) for free?

    What if they put 3 shirts in Thier cart? If they put 4 shirts in Thier cart will they buy 2 get 2 (different) free?

    Will this affect my existing coupons I’ve set up in Magento back office?

    Finally, I have 1.5.1 will that work?

    Thanks so much!

    • PAJ says:

      Will this extension allow my customers to buy 1 tshirt that comes in different colors and sizes for one price… And then get 1 tshirt that also comes in different colors and sizes and (potentially a lesser price) for free?

      >> Yes, but the extension cannot specify any options for the free or reduced tee shirt like size, colour etc. You must create a generic dummy free or reduced tee shirt product that is a simple product with no options and provide the customer with a method to advise you what size colour of freebie they want.

      What if they put 3 shirts in Thier cart? If they put 4 shirts in Thier cart will they buy 2 get 2 (different) free?

      >> Yes this is all configurable in the extension, but my previous answer also applies.

      Will this affect my existing coupons I’ve set up in Magento back office?

      >> NO

      Finally, I have 1.5.1 will that work?

      >> YES.

  49. Anton says:

    Hi PAJ, this is perfect for what we need! Got everything installed without a hitch, however we can’t get it to work. Similar issue with Petra Blankwaard, using 1.6.2 and your latest version v0.70, we setup the products as per your instructions. Product X, product Y (simple product, enabled, 0 price, in stock and saleable). Min qty for product x 1, max 10. When we try to add product X to the cart, it doesnt add our product Y. Same goes with all the other types of promotion like spend x, coupon x. I’ve also setup the email alert, but don’t get any alerts too. We are not using any other extension that extends the shopping cart. Any Ideas? Extension is also enabled in config/advanced page. Hope to hear from you, this would be really awesome ever if we get it to work. Thanks! PS other notes… we have an extension installed “Skip Cart” but its currently disabled. Do you think this has something to do with it?

    • PAJ says:

      Disabling the extension might not do it, if you want to be sure it is conflicting with the buyx module uninstall it by removing the associated etc/module .xml files and then refreshing the cache and test buyx again.

  50. anton says:

    Oh one more question, would it be possible for product Y not to be free? for example, if customer buys a particular product, it will come let say with product Y that has a discounted price with the option to remove the product? Thanks, I think this would be a good option.

    • PAJ says:

      Product Y can be any price you want. Just set the price on the dummy simple product you are using as product y. Customers cannot remove product Y from the cart.

      • anton says:

        Hi PAJ, is there a way to customize the module so that we can allow a user to remove the free product if it had a price? To give you an idea, we will be selling a travel package, with optional insurance added to the cart. If the user does not want insurance, he can simply remove it from the cart, that’s the objective. Hope you can share a snippet where we can edit to allow that. Thanks! By the way got the extension working! you were right, it was conflicting with the skip cart extension.

  51. snezko says:

    Hi i just installed that ind I v got this MSG: Fatal error: Class ‘PAJ_BuyXGetYFree_Helper_Data’ not found in /data/b/e/ on line 520

    any ideas ?

  52. paolo says:

    hi, how can i have more then a gift active?

    if i use coupon A i receive product x
    if i use coupon b i receive product y

    does it work with downloadable products?

    • PAJ says:

      Just configure two dummy products. One will be the gift for coupon A, the other the gift for coupon B. Then configure your coupons and the Coupon X module with the coupon names and the id’s of the two dummy gift products.

  53. Jude says:

    My promotion is : buy X, get Y free if you have the coupon KDOX
    Is it possible with your extension ? I don’t find it.

      • Jude says:

        Sorry but in the Coupon X function, we can’t specify ID product X wich depend product gifted. We can just specify subtotal cart.

      • PAJ says:

        You are completely right. You want the customer to buy a certain product (product X) AND use a coupon to get the free product Y? That code does provide that functionality at the moment. Sorry.

  54. mai says:


    i am running 1.7.02 version
    where can i download the last version of your extension?

    thank you for your help


      • mai says:


        thank you

        i works perfectly for buyXgetYfree with simple product

        but with buycatXgetYfree with a downloaded product i have this error message

        A CategoryXGetYFree Extension cart error was detected!

        thank you for your hemlp.

  55. mai says:


    when the customer is loging, the free product is displayed with a link in the “my order block”

    and this link is pointed on message error page as :

    Whoops, our bad…

    The page you requested was not found, and we have a fine guess why.

    If you typed the URL directly, please make sure the spelling is correct.
    If you clicked on a link to get here, the link is outdated.

    What can you do?
    Have no fear, help is near! There are many ways you can get back on track with Magento Store.

    Go back to the previous page.
    Use the search bar at the top of the page to search for your products.
    Follow these links to get you back on track!
    Store Home | My Account

  56. mai says:


    i have removed the “my order” block and now the customer can not click on the gift link when login.

    please let me know if you can add the downloaded product as a gift in the extension.

    thank you


  57. andrew says:

    Is possible that when I buy a product X of Y given a product free?, ie put in box X 120,38,35 and in the box Y 400,401,401. Then when I bought the 120 free gives me 400 and not the 401 ..? determine bone when I buy a product determine another I say and not another ..?

  58. henk says:

    i have installed the extension and visible in admin.
    Created a product Y, price is zero, available, stock, website is default view
    Id is knowing
    Spend X and get Y (32, free product id is 1276)
    when i order for 32 or more i not get the free product in the basket.
    Got a custom theme, can that influence that?


      • henk says:

        Thanks for responding.

        its one step checkout and i have installed a zipcode check for register, thats it.
        Maybe i can send you server details in pm?


  59. Darpan says:

    Hi Paj,
    I have installed successfully, but Product Y price $80 still added in sub total instead of $0.
    Product X price is $ 110 x 2 = $220, so my total sub order should be $220 instead of $300.

    I used Buy X and get Y free.
    Please help me.


    • PAJ says:

      Hi did you create a new dummy product with a zero price for your Y product, or are you using the *real* product Y?

  60. henk says:

    is it possible, when buy 3 product x you get 1 product y for free?
    when buy 6 then 2 for free etc.. ??

    • PAJ says:

      Yes this is possible using the Category X function there is a product x step config section that lets you specify the “step” required for product x i.e. if you specify a step of 3, then every three products x’s will qualify for 1 product y, i.e. as you say buy three get 1 free, buy six get 2 free. You can then specify a limit for the number of free product Y’s available.

      • henk says:

        i setup like this:
        Product Y Product ID: 1276 (free product)
        Category ID : 39,40,43,27,32,35,37 (all product from those category)
        Max Number of Product Y allowed in cart: 4
        Quantity of product X required to qualify for product Y: (blank so default 1)
        Product X Step: 3

        when i add 2 or 3 or more shirts in cart i only see the message to enter 1 extra product to get the free gift.
        any suggestion?


      • PAJ says:

        This will not work as you expect with multiple categories and one product Y, I would recommend you create a non visible dummy category and make all the product X’s a member of this category. Then configure the module with one category and one product y id. This will then work as expected.

  61. henk says:

    ok, so create a category, make it inactive and add also all the products to this category and choose this category as X

  62. Daniel says:

    Thanks for the free extension! Great!

    Is it possible to set the ‘Cart sub total required to qualify for Product Y:’ inclusive tax.

    I noticed this amount is without tax and the shop has 2 different taxl classes.

    Many thanks!

  63. Ryan says:

    Is there a way to move this out of the configuration area? I want my client to be able to set up the different options for the buy x get y free without having them in the configuration area.

    • PAJ says:

      Create an admin user for the client that only has access to the configuration items in admin that you want, i.e. buyx

      • Ryan says:

        Okay I wasn’t sure if there was an easy way to say make it an menu item like say Customers or Promotions.

  64. hi,
    i have configurable products(shorts with different size and color) in category a and configurable products(t-shirt with different color and size) in category b.

    i want if customer purchase any product from a then he/she will get 1 product free from b.
    1> now i want if customer will purchase any product from category a and then pick any product from b with his /her choice of color and size. then add coupon code to make that t-shirt free.

    is it possible.

    Thank you
    anusuiya dixit

  65. Nick says:

    Hello, great extension!
    One question: Is it possible to idsable the behavior of getting the notice message also on the homepage of a webshop. This because at this moment the customer receives the message ‘Buy one more to qualify for the Buy 2 Sauces get free Spaghetti!’ when he is on the cart-page and when he continues shopping on the homepage the message is still displayed (one time) Is it possible to switch this on or off (even direct in the code of the extension)? Thanks in advance.

    • PAJ says:

      I am aware of this problem. You can disable the notifications entirely by hacking the code. I have not yet found a solution for multiple notifications showing up.

      • Chantie says:

        Can you specify path where the notice msg is located? I’m having an issue with the notice showing up as “Buy 1 more” for the Buy Category X Get Product Y for products not contained within Category X.

  66. Rick says:

    Hi! great extension! save me hours of work!
    just one thing though,
    i have onestepcheckout installed and when i add a promo code it says valid but it doesn’t update the cart with the added product.
    but if i go back to checkout/cart the product is in the cart. and when i go to onestepcheckout/index/ the product is already there.
    so basically, to add the product on the cart after i’ve added a promo code, i needed to go back to the cart and then go to checkout to have the product.

    • PAJ says:

      This is because the Coupon code is triggered by the normal cart index controller. Your onestepcheckout is extending or bypassing this and the event is not trigering the buyx code. You would need to customise the onestep code to also do the buy x checks.

  67. nikolas says:

    I am trying to configure the buy x get y free option but while product y is added correclty to the cart, the price is still shown and added to the total.

    • PAJ says:

      The Y product should be a dummy product with a zero price. If you are using a real product, copy it, set it to not visible in the store and the price to zero, take a note of its ID number and use this as your product Y.

  68. nikolas says:

    This extension is fantastic! Offers more features than some commercial extensions which are being sold for 100$ or more! Thank you for this wonderful module and providing it for free!

  69. Kitty says:

    This is such a fantastic extension! I can’t believe it’s free and it works perfectly! Amazing! Thank you so much for having this available 🙂

  70. Florian says:

    Thank you very much for this free extension! Is there any chance of keeping track of how many coupons have already been redeemed relating to the “Coupon X Get Y Free” extension? There is a report for coupon codes but the coupons defined for “Coupon X Get Y” don’t show up in this report…

  71. Bary says:

    in your description you says:”Product Y must have a unique ID across all configs, buy, spend and coupon”. If I use the same coupon number, does it mean that for every buy (order) I need another product Y? So if I use this coupon first time, free product is normally added, but when I use it second time (the same coupon number) I need to create another product Y with different ID because of unique buy?

    • PAJ says:

      You can use the same product Y id for multiple coupons, but you cannot use the same product Y id for a coupon offer and for example a buy x get y free offer. Try it, the module will throw an error if there is a problem with the Y product.

  72. michele says:

    hi, super extension!!
    one question: I need one free gift (Y id) for different X products, if i duplicate Y products the “Allow duplicate product Y” option set to NO obviously does not work, because the Y ids are all different
    any ideas?

    • PAJ says:

      The best solution would be to create a dummy category, put all your X products into this category and then configure the category X get Y option, this will give you one Y product for different X’s.

  73. WRS says:

    Hi, I want to use this extension very bad.
    I installed everything as you told for installation.
    I updated the cache, however I get a ‘404 Error’ message when I want to configure the extension.
    How can I solve this?

  74. Terence Lim says:

    Thank you for the great extension. I noticed an issue. On cart page, “Clear Shopping Cart” button is not working after free gift is automatically added. Screen shot

    Another possibly bug is that I can no longer update the quantity of product on cart page.

    For your info I’m using “Spend X Get Y Free”. My Magento version is

    I really love this extension and had been searching for this solution for months. Is there any way to get this fixed?

  75. SCS says:

    Hi there,
    We are trying the use the Coupon X Get Y Free. Really like the plugin and had it working at first. When entering the coupon the product ID entered was added to the shopping cart. After changing the ID of the free product to a different ID using the the coupon doesn’t add a product to the cart anymore. The new free product is configured correctly. I also tested setting the ID back to the initial product, but the same outcome. The cart shows the coupon is used, but no product is added. We tried refreshing the cache a number of time, but that didn’t work. Hope you might have an idea were the problem may lie.

  76. Winnie says:

    hello! been using this extension for awhile. how can I add coupon code to empty cart? we’re currently offering free gift for customers.

    Thanks for your help!

    • PAJ says:

      Hi, do you really want to put a free gift in an empty cart? That means I can get something free without ordering anything! Better to make it so the qualifying cart total is $1 or something low…

  77. David Finlay says:


    First love the extension, really is great.

    I need to know if this is possible,

    I want to use the Spend X Get Y Free, however I want to limit it to products in a certain category and I would rather not have to input every other product into the “Products excluded from this offer” input box.

    Please tell me there is an easy way to do this.



  78. Rodel Dagohoy says:


    i have problem on the extension im using klarna checkout i just use spend x free y but nothing happen

    can you help me


    • PAJ says:

      The Buy X Get Y module will not work with other modules that extend the cart controller. You would need to modify the code of the klarna checkout controller in order to combine both modules functionality.

  79. Mickael449 says:


    your extension is great, but i want something more…

    How can I do :

    – I want the “Category X Get Y Free” thing, but only for the first command ?

    – Also, same thing but with 1000€ minimum in cart

    Is it possible ?

    I mean, for each product buyed in a category, get a free product if it is your first command, or if you have 1000€ subtotal in cart

    thank you… !!!

    • PAJ says:

      What do you mean by “first command”? Do you mean first order? So the customer gets a free gift if they have not ordered before?

  80. Mickael449 says:

    Yes that’s right !

    for each product buyed in a category, get a free product (1 free for each product buyed)
    – if it is your first order

    – or if you have 1000€ subtotal in cart

    • PAJ says:

      For the 1000 EUR subtotal you would just use the Spend X feature with the minimum cart total set at 1000 EUR. For the Category X I would need to develop the code to check the customers order history, if no orders exist then the customer qualifies for the free product, if there are orders no free product. In theory this is possible.

      • Mickael449 says:

        thank you for your time

        The problem, with the 1000€ min, it’s that I want a free product for each one that is in the cart ; it is ok in the script ?

        I mean, if there are 5 differents products, the customer will get 5 free products if the subtotal is at 1000€

        and for the customer history, do you think you can do it ?

        It would be perfect, really !

  81. Mickael449 says:

    Hello !

    Don’t know if you get my message, so I put it again :

    thank you for your time

    The problem, with the 1000€ min, it’s that I want a free product for each one that is in the cart ; it is ok in the script ?

    I mean, if there are 5 differents products, the customer will get 5 free products if the subtotal is at 1000€

    and for the customer history, do you think you can do it ?

    It would be perfect, really !

    • PAJ says:

      The customer history is possible, we would need to add some code to the login event that creates a session variable with the order history status. This variable would be used by the BUY X code, if the customer has not ordered before they get the free gift.

      I would need to develop and test this.

      The five free products is possible, will they be 5 different products? For more info email me at the contact address on the blog.

  82. Mickael449 says:

    for the moment, the same product with quantity 5 is good

    is it possible ?

    And what about this customer history ?

    thank you !

  83. Mickael449 says:


    I’m sorry, maybe i’m blind, but I can’t see any contact address, sorry…
    give me the url page where I can find it ^^

    Or please answer me 😉

    I’m always looking for a solution to my problem

    thanx !!!

  84. Ozcan says:


    your extension is great..
    i ask for, Spend 50 and get Y for free. Spend 100 get 2Y for free, spend 200 get 4Y for free. is that possible?

    • PAJ says:

      Yes, you need to configure three dummy Y products to represent your 1Y 2Y and 4Y then configure comma separated values for the spendx category with the ID number of the dummy Y products and the min and max cart spend values to qualify for each Y product e.g.

      Product Y ID
      CART MIN
      CART MAX

      This will give you what you want.

  85. jaaz says:

    where is the download link to download the module , i am not seeing any module link that help me to download that .. can you send me the link or zip file
    of when we purchase x and get added y ass free item module

  86. Kaushal says:

    Hi PAJ,

    I have installed your extension & yes works well but one big question 🙂
    Please go to this link & do quantity 3 & add that product to cart. In backend I have passed it’s ID & the ID of the product which will be automatically added in the cart…..that product is getting included but don’t know why, the total coming including that product’s price.

    So can you please tell me what to do in that case?


  87. Kaushal says:

    Hi PAJ,

    I read the conversations above & one was found exactly similar raised by Rick on 15th July…exactly after a year me raised this issue 🙂 haha

    Reading that conversation I got the idea that I need to make duplicate product with price 0 & use that product’s id.

    Great Extension PAJ. Thanks very much for helping the people in need for such functionality but do not have enough knowledge to create it.

    You are very helpful thanks again 🙂

  88. Kaushal says:

    Hi PAJ,

    One more thing please. Is that possible to get the message like Buy 3 Get 1 Free on respective products?


  89. Kaushal says:

    Hi PAJ,

    The above issue also resolved, what I did in my view.phtml is :-

    $buyProductXID = explode (",",Mage::getStoreConfig('buyxgetyfree_section1/general/productx_product_id'));
    $buyProductYDescription = explode (",",Mage::getStoreConfig('buyxgetyfree_section1/general/producty_description'));

    for($i = 0; $i getId()==$buyProductXID[$i])
    if (!empty($buyProductYDescription[$i]))
    echo " ".$buyProductYDescription[$i]." ";

    Thanks PAJ for this valuable extension 🙂


  90. Kaushal says:

    Hi PAJ,

    Having one question :- Can’t we add date of expiration for each promotion?


  91. plancton says:

    Hello, as said Mike, Elvis and others , it doesn’t work if you never display the shopping cart. It is not only a question of OneStep checkout plugin but it is just in the native backend settings (System > checkout > cart). If you choose No to “After adding a product redirect to shopping cart” then your customers may never see the shopping cart and proceed directly to checkout after adding items to cart. I don’t have oneStepCheckout and I don’t want my customers go to shopping cart after each item add because it breaks the cart filling process so it doesn’t work in most cases for me…

    I know that Magentix Free gift module uses events like and observers to add the gift. It may be a better way to proceed instead of shopping cart controller…
    did kapil sent you the code as he promised to enable one step checkout ?

    • Bogdan V says:

      Hi, Plancton
      Did you find a solution? I use the default shopping cart and the free product appears only after I refresh the shopping cart. So, after I press “add to cart” I’m redirected to the cart and I can only see the X product. The Y product appears only after I refresh the shopping cart.
      Thank you

  92. Bogdan V says:

    If I add a product to the cart, the Y product doesn’t show, until I refresh the page.
    It happens only the first time I add something to the cart, then it works well.
    If I delete the cookie called “frontend” the problem starts again.

    Do you have any idea what might cause the problem?
    Thank you

    • Bogdan V says:

      Somehow, I solved it.
      in CartController.php, around line number 560, I changed this
      if (($subtotal >= $cartTotalRequired && $subtotal checkCustomerGroupId($customerGroupID)) {

      into this

      if ($subtotal checkCustomerGroupId($customerGroupID)) {

      Basically, I removed this condition: $subtotal >= $cartTotalRequired
      I don’t know what the problem was, but now it works.

      • Pradeep says:

        Great fix but it breaks the subtotal validation for the Spend X get Y. Has anyone else found a fix for this or workaround?

  93. Yukari says:

    Boosting the Issue: Y product doesn’t get added to cart until page is refreshed. Has anyone found a solution to this yet? I tried Bogdan’s solution, but I didn’t have anything resembling his code in my CartController.php file.

    Great extension, works better than the Free Gift Pro did on my site. Just wish you didn’t have to refresh or have visited the cart page before as most customers won’t know to do this.

    • PAJ says:

      The extension is triggered by the cart index event which happens when the cart is refreshed/loaded. How would you like it to function, as some cart event must occur for the Buy X logic to be applied and displayed.

      • Yukari says:

        Hi Paj,

        Thanks for replying so quickly. Just for usability’s sake I’d prefer it be triggered instead by the Add to cart button, from either the category page or the product page if the product is over the spend x amount. Our customers are in the older demographic and I doubt they would think to refresh the cart page if the Bonus product wasn’t added. This is really only an issue for customers who add just 1 product to their cart and then proceed to checkout.

        Any help would be much appreciated.

  94. Sofiane says:

    Hello PAJ,

    First i should say thanks for the great extension, my question is can we add multiple offers at same time, so i will have offer 1 free gift 1, and offer 2 free gift 2.??? and will it possible in next versions?



    • PAJ says:

      You can have multiple offers, as many as you like. You just need to comma seperate the values in the config, and you must have unique Y products for each offer.

      • PAJ says:

        So you need to configure

        product Y id : 865,111
        Coupon for Product Y : TEL1,TEL2
        Description Free Scarf,Free Other Thing
        Cart total requiered: 0,0

        This will setup two coupon offers that will put the free product in the cart when the coupons are used.

  95. Harish says:

    Hello Team,
    Looks great extension. Would like to know few details:
    Buy any X, Get any Y cheapest Free – works such that customer can get any 3 products for example, from different categories and 4th product gets automatically free? Buy 3 get 1 Free, i am looking for an extension which could make the cheapest product to be as free one!

    Will your extension works on such case!

  96. Florian says:

    You really should highlight/correct in the examples/documentation/help texts that in the “Coupon X Get Y Free” configuration you have to enter the coupon *code* and not the coupon name… Took me a while to solve the problem…


  97. Marcin Bulik says:

    Hi, you extension used to work great on my Magento CE 1.8.1 but not anymore. The error I get is: Warning: Invalid argument supplied for foreach() in /app/code/local/PAJ/BuyXGetYFree/controllers/Frontend/Checkout/CartController.php on line 522
    Do you know what is causing this error? I have the latest version available on GitHub

  98. amj says:

    spend x get y option not working for guest users. i tried it working perfectly for logged customers but not working perfectly for guest users

  99. Ashik says:

    This extension is great for me. we installed this extension but it can’t calculate the discount.
    we choose the buy X get Y.
    Please help us
    Thanks in advance

  100. Yurio says:

    Hello PAJ,
    I already test this extensions.
    How to make Buy X quantity A item get exactly X quantity B item.
    For example i bought 5 A, and then i want to get 5 B for Free.

    Thanks in advance.


  101. Arun says:

    Hi How can I uninstall and reinstall it . reason I have deleted the coupon but still it is applying the coupon. so I want to uninstall and install it again.

  102. Ed says:

    Hi PAJ,
    Great tool. I have the extension installed but when I add the product X to cart (I’m using the “Buy X Get Y free” feature…I haven’t tested the other features yet.), the unit price of product Y doesn’t change to 0(in fact it doesn’t change at all). I installed it on Magento version Please help. Thank you.


    This issue happens-Offer not multiplied with qty update in cart.

    Suppose if we add 4 product or 3 products in the cart then he will get 4 or 3 products free.
    but that is not working.

    How to work that offer in that way?

    If it is possible to change the logic in the script then please change it.

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