#StackBounty: #magento2 #price #catalog #product-list #tierprice Magento2 – include possible tier price in getProductPrice() product list

Bounty: 50

Our customer would like to display lowest possible price in product list pages

This is the function which displays the price

MagentoCatalogBlockProductListProduct

public function getProductPrice(MagentoCatalogModelProduct $product)
{
    $priceRender = $this->getPriceRender();

    $price = '';
    if ($priceRender) {
        $price = $priceRender->render(
            MagentoCatalogPricingPriceFinalPrice::PRICE_CODE,
            $product,
            [
                'include_container' => true,
                'display_minimal_price' => true,
                'zone' => MagentoFrameworkPricingRender::ZONE_ITEM_LIST,
                'list_category_page' => true
            ]
        );
    }

    return $price;
}

The fast try (changing MagentoCatalogPricingPriceFinalPrice::PRICE_CODE to MagentoCatalogPricingPriceTierPrice::PRICE_CODE) obviously doesn’t work, as TierPrice should return an array or some complex data and not a price amount

How to achieve this? Any tips?


Get this bounty!!!

Leave a Reply