calculateCheapestAvailablePrice example

$rules = $product->getPriceRules();
        if (!$product->getCheapestPriceRule() && !empty($rules)) {
            $product->setCheapestPriceRule(clone $rules[0]);
        }

        if ($product->getCheapestPriceRule()) {
            /** * Calculation with considering min purchase */
            $rule = clone $product->getCheapestPriceRule();
            $product->setCheapestPrice(
                $this->calculateCheapestAvailablePrice($product$rule$context)
            );

            /** * Calculation without considering min purchase */
            $rule = clone $product->getCheapestPriceRule();
            $product->setCheapestUnitPrice(
                $this->calculatePriceStruct($rule$tax$context)
            );
        }

        
Home | Imprint | This part of the site doesn't use cookies.