0

On my category pages, for tier priced products the tax is added twice to the add low as price:

As Low As

This file: /vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml uses the function renderAmountMinimal() from block \Magento\Catalog\Pricing\Render\FinalPriceBox. to return the values:

public function renderAmountMinimal()
{
    $id = $this->getPriceId() ? $this->getPriceId() : 'product-minimal-price-' . $this->getSaleableItem()->getId();

    $amount = $this->minimalPriceCalculator->getAmount($this->getSaleableItem());


    if ($amount === null) {
        return '';
    }

    return $this->renderAmount(
        $amount,
        [
            'display_label'     => __('As low as'),
            'price_id'          => $id,
            'include_container' => false,
            'skip_adjustments' => true
        ]
    );
}

Looking at the object returned in $amount the amount does seem to have added my tax twice before this object is created.

The product pages however show the amounts correctly its just category pages they seem to be wrong for some reason.

1 Answer 1

1

This is my solution, not elegant, but it works!

public function renderAmountMinimal()
    {
        $id = $this->getPriceId() ? $this->getPriceId() : 'product-minimal-price-' . $this->getSaleableItem()->getId();
$amount = $this->minimalPriceCalculator->getAmount($this->getSaleableItem());

        if ($amount === null) {
            return '';
        }

        $minTierPrice = $this->minimalPriceCalculator->getValue($this->getSaleableItem());
        // var_dump($minTierPrice); // work

        // var_dump($amount);
        // Nos indica lo siguiente:
        // object(Magento\Framework\Pricing\Amount\Base)#6089 (5) { ["amount":protected]=> float(20141.975801) ["baseAmount":protected]=> NULL ["totalAdjustmentAmount":protected]=> NULL ["adjustmentAmounts":protected]=> array(1) { ["tax"]=> float(5957.4822) } ["adjustments":protected]=> array(0) { } } Tan bajo como $20.142


        /*
        return $this->renderAmount(
            $amount,
            [
                'display_label'     => __('As low as'),
                'price_id'          => $id,
                'include_container' => false,
                'skip_adjustments' => true
            ]
        );
        */

        // var_dump($amount);                      
        // $mycustomMinPrice = round($minTierPrice);
        $mycustomMinPrice   = number_format($minTierPrice, 0, '', '.');

        return __('As low as').' $'. $mycustomMinPrice; // work        
    }

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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