Skip to content

Instantly share code, notes, and snippets.

@insaurabh
Last active June 16, 2018 14:57
Show Gist options
  • Save insaurabh/4b17a48543b31379554a78477417b590 to your computer and use it in GitHub Desktop.
Save insaurabh/4b17a48543b31379554a78477417b590 to your computer and use it in GitHub Desktop.
Magento 2 file extend
#File name : /your-custom-module/view/frontend/layout/catalog_product_view.xml
<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="[Namespace]\[Modulename]\Block\Product\View\SomeName"
after="-"
name="customname.somename"
template="product/view/custom_template_name.phtml" />
</referenceContainer>
// to override addtocart section { action }
<referenceBlock name="product.info.addtocart.additional">
<action method="setTemplate" ifconfig="pincode/general/active">
<argument name="template" xsi:type="string">Custom_ModuleName::product/view/addtocart.phtml</argument>
</action>
</referenceBlock>
</body>
</page>
# File Name : /your-custom-moduleview/frontend/templates/product/view/custom_template_name.phtml
<div>
Create your view/structure here that you want to show below ADD TO CART button
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment