1

How to extend vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml so I can add another button to it?

I tried it by creating my own module and copied the above file to app/code/"vendorname"/"modulename"/view/frontend/templates/form.phtml and created an xml file app/code/"vendorname"/"modulename"/view/frontend/layout/checkout_cart_index.xml that has the following content:

               <referenceBlock name="checkout.cart">
                    <action method="setTemplate">

                         <argument name="template" xsi:type="string">Rampart_Core::form.phtml</argument>

                    </action>
               </referenceBlock>

But it override the cart page and display only a portion of the original-cart page whereas I want to add button to existing cart page.

2

This is simple to extend form.

Here you can extend: vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml

Extend it same: app/design/frontend/VENDOR/Theme_Name/Magento_Checkout/templates/cart/form.phtml

-- you only need to update :VENDOR/Theme_Name

This is suffice if you only to update button in form.phtml and there is no need to extend/overwrite module for it.

  • It's not working. Cart page is empty now – Karts Jul 17 '17 at 9:54
  • I hope you have extend theme ? And after above edit: You need to delete your module. And run upgrade and compile commands. It must work. – Jai Jul 17 '17 at 9:55

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.