1

When I copy checkout_cart_index.xml page to my theme it works fine but when I change

<block class="Magento\Checkout\Block\Cart\Grid" name="checkout.cart.form" as="cart-items" template="Magento_Checkout::cart/form.phtml" after="cart.summary">

to

<block class="Magento\Checkout\Block\Cart\Grid" name="checkout.cart.form" as="cart-items" template="Magento_Theme::cart/form.phtml" after="cart.summary">

For overriding a template file from my theme the discount coupon form disappears and it also disappears from from html too.

Thanks in advance.

2
  • 1
    only phtml file override as your theme path folder not to xml file need to override. Feb 21, 2018 at 12:40
  • If I do not override XML theme path it get template from module_checkout rather than my custom_theme Feb 21, 2018 at 13:10

2 Answers 2

1

If you want to override the the .phtml template file try to put your form.phtml file inside

app/design/frontend/YourVendorThemeName/YourAciveThemeName/Magento_Checkout/templates/cart/form.phtml

You should use setTemplate action in layout xml file, if you want to override phtml from your custom module

checkout_cart_index.xml

    <?xml version="1.0"?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
       <body>        
          <referenceBlock name="checkout.cart.form">
             <action method="setTemplate">
                 <argument name="template" xsi:type="string">Magento_Theme::cart/form.phtml</argument>
             </action>
          </referenceBlock>
       </body>
    </page>
1

All I do is move checkout.cart.coupon to my container and it is was apparent where I want. Here is the code

<move element="checkout.cart.coupon" destination="summary-col1" before="-"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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