Trying to implement the buy 1 get 1 free but making it incremental. If a customer adds 2 products, customer gets 2 of the same product free. If a customer adds 3 products, customer gets 3 of the same product free and So on. Is this possible with shopping cart rules? if not, is there a reference site with code, that I can use to make it work.

 protected static function _getFreeQuoteItem(Mage_Sales_Model_Quote $quote, $sku, $storeId, $qty)
    if ($qty < 1) {
        return false;
    } else {

    /** @var Mage_Catalog_Model_Product $product */
    $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $sku);

    if ($product == false) {
        return false;


    if ($product->isSalable() == false) {
        return false;

    $quoteItem = Mage::getModel('sales/quote_item')->setProduct($product);
            ->setWeeeTaxApplied('a:0:{}') // Set WeeTaxApplied Value by default so there are no "warnings" later on during invoice creation
    $quoteItem->addOption(new Varien_Object(array(
        'product' => $product,
        'code' => 'info_buyRequest',
        'value' => serialize(array('qty' => $qty, 'is_free_product' => true))
    // With the freeproduct_uniqid option, items of the same free product won't get combined.
    $quoteItem->addOption(new Varien_Object(array(
        'product' => $product,
        'code' => 'freeproduct_uniqid'.$sku,
        'value' => uniqid(null, true)

    return $quoteItem;



Below extension links allow you to add free product to your cart. To do allow this, a new action "add a gift" is added to the cart price rules.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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