How do we add the 'Inclusive of all taxes' label after the original price of the product on the product page in magento2?

659 views Asked by At

Please help me how I can display the label 'Inclusive of all taxes' after the original product price on the product page in the magento2 platform?

And also let me know the file structure where I can easily add the HTML code to show the same.

see the screenshot for your reference: https://prnt.sc/10hqx9e

<div class="product-info-price"><div class="price-box price-final_price" data-role="" data-product-id="" data-price-box=""><span class="label-taxes"><label>Inclusive of all taxes</label></span></div></div>

The above code is just a dummy code but I have used the default div structure of magneto2 of product pages.

Please help!

Thanks in Advance.

1

There are 1 answers

1
ZealousWeb On

First If you want to display custom text only in product view page, then create catalog_product_view.xml in your custom theme on path app/design/frontend/Your-theme/theme/Magento_Catalog/layout/catalog_product_view.xml

add this Code

<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>

Now create customtext.phtml file on path app/design/frontend/Your-theme/theme/Magento_Catalog/templates/view/customtext.phtml

Add below code

<div class="product-info-price">
    <div class="price-box price-final_price">
        <span class="label-taxes">
            <label><?php echo __("Inclusive of all taxes") ?></label>
        </span>
    </div>
</div>

Don't forget to clear cache:)