0

I need to add the Saving percentage label to the product after the price on the category listing page and product details page.

I managed to do this for configurable products by adding the below code to

/app/design/frontend/theme/Magento_ConfigurableProduct/templates/product/price/final_price.phtml

<span class="price-percentage-pdp price-percentage">
    <?php $percentage = 100 - round(($finalPriceModel->getAmount()->getValue() / $priceModel->getAmount()->getValue())*100); ?>
    <?php echo $percentage ."% OFF"?>
</span>

This is working fine.

How & where can I add a special price percentages for simple products & bundle products?

2 Answers 2

3

For Simple

/vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml

override on below path

/app/design/frontend/theme/Magento_Catalog/templates/product/price/final_price.phtml

For Bundle

/vendor/magento/module-bundle/view/base/templates/product/price/final_price.phtml

override on below path

/app/design/frontend/theme/Magento_Bundle/templates/product/price/final_price.phtml
2
  • Thank you very much for your answer, it helped me
    – Mujahidh
    Sep 27, 2021 at 5:39
  • welcome.. happy coading!! Sep 27, 2021 at 6:58
2

You can use the Product label from Scommerce Mage to create a variety of product labels. This module has several inbuilt variables that can be used to pull in dynamic data such as stock, special price, discount, SKU, save_percent, price including/excluding tax, and much more. Simply call in the variable in the label text which will add the discount to the label. For eg:- Save : {save_percent}. The conditions setting can be used to assign the label to a single product or a variety of products all at once.

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.