2

Hi I want to add "VAT excl " text after the product price in single product page . How can i do this . Which file i need to edit . Please suggest the correct path

app/design/frontend/mythemes/default/Magento_Catalog/templates/

1 Answer 1

2

Method - 1: If you want to display custom text only in product view page, then create catalog_product_view.xml in your custom theme

app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_product_view.xml

<?xml version="1.0" ?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="product.info.main">
            <block class="Magento\Framework\View\Element\Template" name="custom.text" template="Magento_Catalog::view/customtext.phtml" after="product.info.price"/>
        </referenceContainer>
    </body>
</page>

Now create customtext.phtml and add your custom text

app/design/frontend/Vendor/theme/Magento_Catalog/templates/view/customtext.phtml

Now flush the cache and check

Method - 2: If you want to display custom text after price at everywhere then override final_price.phtml

FROM

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

TO

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

Method - 3: Last and the most simple way to do it with CSS

 .product-info-price .price:after {
    content: 'Custom Text';
}
2
  • i tried first method by adding files on this path cache and static contents cleared but didn't works, any idea why this happening, thank you /app/design/frontend/maintheme/subtheme/Magento_Catalog/layout/catalog_product_view.xml /app/design/frontend/maintheme/subtheme/Magento_Catalog/templates/product/view/customtext.phtml Mar 29, 2021 at 4:05
  • I want to add a custom text through out the website, so followed the second method, but it's does not work
    – senthil
    Dec 13, 2022 at 15:02

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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.