Magento 2.1 – How to Show Tier Price in Catalog Page

catalogmagento-2.1tierprice

I have setup a tier price for my Magento 2 product and I can see the tier price on product details page like below screen shot.

enter image description here

I need to show the same "Buy 3 for $0.00 each and save 100%" in my catalog page also. Is there any way to show like this? Can anyone help me?

Best Answer

You can add tier prices from admin panel.

Navigate to Admin Panel > Catalog > Product > Add/Edit Product > Advance Pricing (below price input box) > Tier Price > Add

Magento shows tier price in product view page by default. If you want to show tier price in product list page then put below code in your list.phtml file where you want to show tier price.

if($_product->getTierPrice()){
    $tier_price = $_product->getTierPrice();
    foreach ($tier_price as $key => $value) {
        $qty = (int)$value['price_qty'];
        $price = $value['price'];
        $formattedPrice = $this->helper('Magento\Framework\Pricing\Helper\Data')->currency(number_format($price, 2), true, false);
        $savePercentageFormat = ceil(100 - ( (100 / $_product->getPrice())* $value['price']) ) ."%";

        echo "Buy $qty for ".$formattedPrice." each and save ".$savePercentageFormat;
        echo "<br>";
    }
}
Related Topic