1

after extending product main info container I do not see any add to cart form in product view. Checking the logs I see

main.CRITICAL: Invalid template file: 'product/view/addtocart.phtml' in module: 'MY_Custom' block's name: 'product.info.addtocart' []

the way as I extended in my theme

<referenceContainer name="content">
        <container name="product.container" as="productContainer" htmlTag="div" htmlClass="product-container" before="-">
            <block class="MY\Custom\Block\Info" name="custom.info" template="MY_Custom::info.phtml">
                <arguments>
                    <argument translate="true" name="title" xsi:type="string">Special Product</argument>
                </arguments>
            </block>
        </container>
    </referenceContainer>
    <move element="product.info.addtocart" destination="product.info.main" />
    <move element="product.info.main" destination="product.container" />
    <move element="custom.info" destination="product.info.main" />
    <move element="product.info.media" destination="product.container" after="product.info.main" />

Actually I would like to keep all other references I do not want to override

0

You should set product.info.addtocart block template file by below code:

        <referenceBlock name="product.info.addtocart">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Magento_Catalog::product/view/addtocart.phtml</argument>
        </action>
    </referenceBlock>
  • 1
    thanks is working but instead I added the xml to custom module which extends in this case the base module – fefe Apr 20 '16 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.