1

How to add some text before price of product in product details page . for

example:- price - $200.00.

Guys any suggestion from your end.Thanks

2 Answers 2

6

You need to make changes in price-box.js which is placed at

/vendor/magento/module-catalog/view/base/web/js/price-box.js

Make sure you take this js in your custom theme folder and make changes on line number 22 near priceTemplate: '<span class="price"><%- data.formatted %></span>'

Add your custom text after <span class="price">

Some thing like this,

priceTemplate: '<span class="price">Price - <%- data.formatted %></span>'

Done.

1
  • How to add this text only for old price? It gets added for special price also..
    – aravind
    Commented Dec 14, 2018 at 10:37
0

I used magento 2.4.3
I modified this file in line 20 and it works correctly
try this

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.