11

I'm setting up products and tier prices in Magento, but I've noticed that a in Simple Product with Custom Options (example: blue t-shirt, red t-shirt), the Tier Price won't work if we combine them to reach the quantity.

Tier Prices seem to work only when the quantity is reached from one product variation, but not a combination of two.

I've read several answers on Stack Overflow and the Magento forums, and they recommend to create configurable products. However this can be pretty hard if a store has lots of products, or lots of variations.

Do you know some workaround to get the Tier Price apply - with a combination of variations?

5
  • can you precise what is the type of blue t-shirt and red t-shirt ? Are they single products with no link between them ? Commented Sep 24, 2014 at 13:34
  • They would be Custom Options ("Blue", "Red") of a Simple Product "T-Shirt". On Magento currently, if the Tier Price was, let's say, "10 or more you get a discount", it would work when purchasing 10 Reds or 10 Blues, but not when I'd purchase 5 + 5...
    – Peanuts
    Commented Sep 24, 2014 at 16:11
  • How can magento know that these two products are linked ? Commented Sep 25, 2014 at 7:22
  • Well in my example there's only 1 product (Simple Product), that has two custom options (variations): blue and red. Magento doesn't calculate a tier price when you add up two options of the same Simple Product (we are talking about Simple Products here, not Configurable Products). For Configurable Products, there's an extension that allows Tier Price combining (magentocommerce.com/magento-connect/…), but again, this is not my case, we have too many options to create a product per option).
    – Peanuts
    Commented Sep 26, 2014 at 9:31
  • You will need a custom module to achieve this. Or if I was you, I would consider using configurable products with the tier price module you mentioned.
    – paj
    Commented Sep 28, 2015 at 10:20

2 Answers 2

11
+25

The problem here is that Magento treats products with different custom options as different line items in cart. So, the qty for the two variants of custom options never adds up to be able to qualify the quote item for a particular tier of tiered pricing.

Now, making this work would involve custom work. I can give you pointers as to where you can look to make it work in the code.

Checkout Mage_Sales_Model_Quote_Address_Total_Subtotal::collect()

In this method you will need to loop through all the quote items and link the tiered quantity applicable on each of the quote items. So say, you have two variants A and B with quantity 1 and 3. You will loop through the quote items and do something like:

$quoteItemA->setTieredQty(1+3);
$quoteItemB->setTieredQty(1+3); //ofcourse 1 and 3 are dynamic here

Then in Mage_Sales_Model_Quote_Address_Total_Subtotal::_initItem

instead of using: $finalPrice = $product->getFinalPrice($quoteItem->getQty()); //on line 115 use:

$finalPrice = $product->getFinalPrice($quoteItem->getTieredQty());

This involves custom work but the approach I'm listing should work with some on the fly adjustments as you work through it.

4

I can confirm, this works

        /* hard coded - start */ 
        $cart = Mage::getModel('checkout/cart')->getQuote();
        $total_qty = 0;
        foreach ($cart->getAllItems() as $item2) {
          if ($item2->getProductId() == $quoteItem->getProductId()) $total_qty+= $item2->getQty();    
        }
        $finalPrice = $product->getFinalPrice($total_qty);
        // $finalPrice = $product->getFinalPrice($quoteItem->getQty());
        /* hard coded - end */ 

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.