If you want to show custom text after price on product detail page in product view page, then follow the below steps.
1. Create catalog_product_view.xml in your custom theme
app/design/frontend/[Vendor_name]/[theme_name]/Magento_Catalog/layout/catalog_product_view.xml
1 2 3 4 5 6 7 8 |
<?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="price.after.text" template="Magento_Catalog::view/price_after_text.phtml" after="product.info.price"/> </referenceContainer> </body> </page> |
Now you have to create price_after_text.phtml fle and add your custom text in it
app/design/frontend/Vendor/theme/Magento_Catalog/templates/view/price_after_text.phtml
2. If you want to set custom text after price at everywhere then override default final_price.phtml file
from
vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
to
app/design/frontend/[Vendor_name]/[theme_name]/Magento_Catalog/templates/product/price/final_price.phtml
3. Most easy way to doing it with some style
1 |
.catalog-product-view .product-info-price .price:after { content: 'per piece'; } |
After doing above task run below commands
1 2 3 |
- php bin/magento setup:upgrade - php bin/magento setup:static-content:deploy - php bin/magento cache:clean |
That’s it.
Now clean cache and check your product page for custom text after price.
[crayon-63d3e934ebaf0866586085/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.