How to add a common text after the price in magento 2

How to add a common text after the price in magento 2

July 27, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add a common text after the price in magento 2

Adding “VAT Excl” Text After Product Price in Magento 2

As an experienced e-commerce developer, I often encounter clients who want to add a common text suffix like “VAT excl” after the product price on their Magento 2 storefronts. In this post, I’ll guide you through the process step-by-step, ensuring you have all the necessary information.

Understanding the Magento 2 Theme Structure

Before we dive into the code changes, let’s quickly review Magento 2 theme structure:

  • app/design/frontend: Contains all your custom themes.
  • <Your_Theme_Name>: The directory for your specific theme.
  • Magento_Catalog/templates/product/price : The folder where the price display templates are stored.

Step-by-Step Guide to Add “VAT Excl” Text

1. Create a New Directory and File

First, navigate to the path mentioned in your question:

app/design/frontend/<Your_Theme_Name>/<Your_Variant_Name>

If this directory doesn’t exist, create it. Inside this new or existing theme variant folder, create a new folder called Magento_Catalog if it’s not present already.

Within Magento_Catalog, create another folder named templates.

Finally, inside the templates folder, make a new sub-folder called product.

In the product folder, you’ll need to create a new file named price.html.

2. Edit the price.html File

Open the newly created price.html file and add the following XHTML code:

<?php $basePrice = $block->getProduct()->getFinalPrice(); ?>
<?php $basePriceHtml = $block->getProduct()->getFormattedPrice('fixed'); ?>

<div class="price-box" data-price-type="fixed">
    <span class="regular-price" id="product-price-<?= /* @escapeNotVerified */ $block->getProductId() ?>">
        <?= /* @escapeNotVerified */ $basePriceHtml ?>
    </span>
    <span class="special-price" id="product-price-<?= /* @escapeNotVerified */ $block->getProductId() ?>-special">
        <?= /* @escapeNotVerified */ $block->getProduct()->getSpecialPriceHtml() ?>
    </span>

    <!-- Add the "VAT Excl" Text Here -->
    <span class="tax-label">(VAT excl)</span>
</div>

This code fetches and displays your product’s regular price. We’ve added a new span element at the end of the file to display the “VAT excl” text.

3. Verify Your Changes

Save the file, then clear Magento’s cache:

php bin/magento cache:clean

or if you are using Magento 2.3+

php bin/magento cache:flush

Finally, log out and log back into your Magento admin panel or refresh your product page to see the changes.

Conclusion

Adding text suffixes like “VAT excl” after the price in Magento 2 requires a simple file edit within your theme. Always remember to work with child themes to avoid losing customizations during updates. If you’re new to theme development, I recommend starting with our comprehensive guide on Understanding and Creating Child Themes for a more detailed understanding.

As always, if you need further assistance or have other Magento 2 queries, feel free to reach out. Our team at LaravelCompany is here to help!

Magento 2 Catalog Themes Pricing

Our network