Magento Discount Rules – Buy X Get Lowest Priced Item

I figured out today that the discount/promotion rules in Magento aren’t exactly obvious, nor straight forward to apply. If you don’t have the logical mind of a programmer, setting up rules for products that only meet certain criteria can be a tricky one. Take this example:

Buy 4 for 3 on any product in [this] category.

Sounds simple, no? Actually, no. Things you have to take into account are:

  • Number of items in the cart
  • Categories of all products in the cart
  • Products that may not be in the specified category in the rule actions
  • Number of these products also

So, bearing in mind all this, and working with the constraints of Magento’s rule condition selections, Here’s how we come with the solution. In these examples, we’re using this extension, with this fix, on Magento

Rule Information

  • Name: Buy 4 for 3 from [example] category
  • Description: Buy 4, get cheapest item free from [example] category.
  • Status: Active
  • Website: [make your selection]
  • Customer Groups: [make your selection – we’re using NOT LOGGED IN and General]
  • Coupon code: B4F3
  • Uses per coupon: 0
  • Uses per customer: 0


  • If ALL of these conditions are TRUE
    • If total quantity equals or greater than 4 for a sub-selection of items in cart matching ALL of these conditions:
      • Category is 2604


  • Apply: Buy X get lowest item free (Discount amount is lowest item price)
  • Discount amount: 1
  • Max Qty discount is apply to: 0 (this allows groups of 4 items to be discounted 1 item)
  • Discount Qty Step: 4
  • Free Shipping: No [but as your requirements]
  • Stop processing further rules: No
  • If ALL of these conditions are TRUE:
    • Category is 2604

Labels: As you require

Save the rule and test by adding a various combination of different products from different categories into your cart. It’ll discount 1 of the the cheapest item(s) of any products matching the criteria, 1 product for each multiple of 4 products. If you proceed to add a product into the cart form another category, it will ignore this product. If you subsequently remove one of the matching products from the cart, even though there may still be 4 items in the cart, the 4th item doesn’t match the criteria, therefore the discoule rule no longer takes effect, and is removed.

Magento is very powerful – it’s just not exactly obvious!

Join the Conversation


  1. Hi
    I am new to Magento

    Is it possible in magento that I buy total products of $500 products and get 1 product free

    Can I set such rule.

    Viral Mehta

  2. Yes, you should be able to do that. Under “Conditions”, if you use the “Cart Attribute – Subtotal” “equals or greated than” “500”, then use the “Actions” to specify the conditions for the free item (for example, “Product Attribute – Category” “contains” “[Select Category/ies]”). Then set “Discount Amount” = “Percent of product price”, set “Discount Amount” to 100 (100%), “Max Qty Discount is applied to” = 1, and the other actions and rules to suit.

  3. Fatal error: Call to undefined method Mage_SalesRule_Model_Mysql4_Rule_Collection::getIsValid()

    error is come in cart page


  4. I am setting up the rule for 1 in 12; it works if the 12 are the same product, but not if they are combined. Any ideas?

Leave a comment

Your email address will not be published. Required fields are marked *