2

Is there a way to make a bundled product options disregard any catalog price rules that are applied to them?

Let's say I have a product like the following:

Product: Bundled Product 1
Type: Bundle
SKU: Bundle-1

Which has various options:

  1. Option 1
    • Product A1 - € 10,-
    • Product A2 - € 15,-
  2. Option 2
    • Product B1 - € 50,-
    • Product B2 - € 90,-

All of which are also sold seperately in the store.

If I were to make a catalog price rule for product A1 for let's say a 50% discount. The price for option A1 would drop to €5,-. Which is fine when sold seperately but I do not want this price in the bundled product. Instead, the bundle should have a discount of its own (Let's say 20%) for the whole bundle. Thus ignoring the catalog price rule for A1.

Is this possible at all?

In Magento 1 I found an option called "Subproducts Discount" but this seems to be removed in Magento 2.0.1 and onwards.

0

Not the best solution perhaps, but it's possible by overriding the bundle product price model. With the override you can change the getFinalPrice to getPrice. Basically telling the price modal to completely disregard any price changes applied through special prices or catalog price rules for the simple products.

di.xml

...
<preference for="Magento\Bundle\Model\Product\Price" type="Vendor\Mymodule\Plugin\Magento\Bundle\Model\Product\Price" />
...

Vendor\Mymodule\Plugin\Magento\Bundle\Model\Product\Price

<?php

namespace Vendor\Mymodule\Plugin\Magento\Bundle\Model\Product;

class Price extends \Magento\Bundle\Model\Product\Price
{
    public function getSelectionFinalTotalPrice(
        $bundleProduct,
        $selectionProduct,
        $bundleQty,
        $selectionQty,
        $multiplyQty = true,
        $takeTierPrice = true
    ) {

        if (null === $bundleQty) {
            $bundleQty = 1.;
        }
        if ($selectionQty === null) {
            $selectionQty = $selectionProduct->getSelectionQty();
        }

        if ($bundleProduct->getPriceType() != self::PRICE_TYPE_DYNAMIC) return parent::getSelectionFinalTotalPrice($bundleProduct, $selectionProduct, $bundleQty, $selectionQty, $multiplyQty, $takeTierPrice);

        $price = $selectionProduct->getPrice($takeTierPrice ? $selectionQty : 1); // Overwrite to getPrice instead of getFinalPrice

        if ($multiplyQty) {
            $price *= $selectionQty;
        }

        return min(
            $price,
            $this->_applyTierPrice($bundleProduct, $bundleQty, $price),
            $this->_applySpecialPrice($bundleProduct, $price)
        );
    }
}

After this the individual items in a bundled product no longer used their discounted prices. We could then give a discount to the entire bundle through the special price option in the Magento 2 backend.

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.