Extend tier_price.phtml in child theme of a custom theme Magento 2
-
20-02-2021 - |
Domanda
From:
/vendor/magento/module-configurable-product/view/base/templates/product/price/tier_price.phtml
To:
/app/design/frontend/Mgs/claue_child/Magento_Catalog/templates/product/tier_price.phtml
I create child theme now want to extend few files but i am stuck.
Flushed cache and added the site in developer mode.
Tried : How to overwrite tier_price.phtml in Magento 2
Update Solution: Correct path:
app/design/frontend/Mgs/claue_child/Magento_ConfigurableProduct/templates/product/price/tier_price.phtml
Command used : sudo rm -rf var/ && sudo rm -rf pub/static && sudo php bin/magento setup:static-content:deploy -f && sudo php bin/magento cache:flush && sudo chown www-data:www-data -R *
Thank you @chirag-patel and @ylgen-guxholli for your support.
Soluzione
Did you removed generated and static files ?
rm -rf generated/*
rm -rf pub/static/*
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
Add the price directory in your override
/app/design/frontend/Mgs/claue_child/Magento_ConfigurableProduct/templates/product/price/tier_price.phtml
and see if your theme is generating the static files.
Altri suggerimenti
You define wrong at Magento_Catalog
because core file path is belongs to from module-configurable-product
module and you write Magento_Catalog
so no file found tier_price.phtml in Magento_Catalog
core module.
You have to write Magento_Configurable_Product
insted of Magento_Catalog
Try with below way.
/app/design/frontend/Mgs/claue_child/Magento_Configurable_Product/templates/product/price/tier_price.phtml
Remove /var
& /generated
folder then run below command.
php bin/magento c:f
php bin/magento c:c