Question

How I can show only qty of tired price in grouped products? For title of my tabel.

This code display all tired prices- qty with price:

<?php foreach ($_associatedProducts as $_item): ?>
    <?php if ($block->getCanShowProductPrice($_product)
    && $block->getCanShowProductPrice($_item)
    && trim($block->getProductPriceHtml(
        $_item,
        \Magento\Catalog\Pricing\Price\TierPrice::PRICE_CODE

    ))): ?>

        <?= $block->getProductPriceHtml(
            $_item,
            \Magento\Catalog\Pricing\Price\TierPrice::PRICE_CODE
        ) ?>

     <?php endif; ?>
     <?php endforeach; ?>

and if I go do tierprices.phtml

<?php /* @escapeNotVerified */ echo ($block->getShowDetailedPrice() !== false)
                    ? __(
                        '%1 for %2',
                        $price['price_qty'],
                        $priceAmountBlock,
                        $index,
                        $tierPriceModel->getSavePercent($price['price'])
                    )
                    : __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock);
            ?>

but if I copy this code I have error price not defined

Was it helpful?

Solution

I just overwrite and copied this file to myvendor/mytheme/Magento_Catalog/templates/product/price/tier_prices.phtml

and changed:

   <?php /* @escapeNotVerified */ echo ($block->getShowDetailedPrice() !== false)
            ? __(
                '%2',
                $price['price_qty'],
                $priceAmountBlock,
                $index,
                $tierPriceModel->getSavePercent($price['price'])
            )
            : __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock);
    ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top