Change price template only for product view page?

2018-01-24 07:32:12

as far as I understand this the price is rendered in:

/app/code/Magento/Catalog/view/base/templates/product/price/amount/default.phtml

But as I change it, it gets, of course, changed for every part of the site (like category view).

How can I change how my price is displayed in my product view? If I for example want to add labels for price incl. tax and excl. tax, tax amount, etc..?

In catalog_product_view.xml there is a block (product.price.render.default) which is responsible for price rendering.

That block you can find in below paths:

/vendor/magento/module-catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE.xml

/vendor/magento/module-catalog/view/base/layout/default.xml

which is this:

catalog_product_prices

  • In catalog_product_view.xml there is a block (product.price.render.default) which is responsible for price rendering.

    That block you can find in below paths:

    /vendor/magento/module-catalog/view/adminhtml/layout/CATALOG_PRODUCT_COMPOSITE_CONFIGURE.xml

    /vendor/magento/module-catalog/view/base/layout/default.xml

    which is this:

    catalog_product_prices

    true

    You can copy this block to catalog_product_view.xml inside body tag and change this

    catalog_product_prices

    to this

    custom_catalog_product_prices

    2018-01-24 08:51:42