I want to override :
vendor/magento/module-catalog/view/frontend/templates/product/view/addtocart.phtml
I have copied and pasted it in my custom module at :
app/code/Hello/Custom/view/frontend/templates/product/view/addtocart.phtml
This is my Layout file:
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.addtocart" template="Hello_Custom::product/view/addtocart.phtml" after="alert.urls">
</referenceBlock>
</body>
</page>
at:
app/code/Hello/Custom/view/frontend/layout/catalog_product_view.xml
module.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Hello_Custom" setup_version="1.0.0" schema_version="1.0.0">
</module>
</config>
- Module is working for simple hello world so its registered correctly ...
The issue is in template path hints file comes from vendor.. but it should come from my custom module only (not from theme)
default.xmlis loaded on every page butcatalog_product_view.xmlis only loaded on thecatalog/product/viewaction. – Jacques Oct 27 '17 at 12:25