cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a button adjacent to Update cart button in Magento2.1 cart page?

SOLVED

How to add a button adjacent to Update cart button in Magento2.1 cart page?

How can I add a custom button adjacent to Update Shopping car button in Magento2.1?

 

temp.png

I created a file checkout_cart_index.xml with following content.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block template="Namespace_Module::custom/mybutton.phtml" class="Magento\Framework\View\Element\Template" name="my.button" as="my.button"/>
        </referenceContainer>
    </body>
</page>

 But it shows button below the Apply Discount Code section.

---
Problem Solved Click Accept as Solution!:Magento Community India Forum
3 REPLIES

Re: How to add a button adjacent to Update cart button in Magento2.1 cart page?

If you want it exactly next to that button then I think you'll have to resort to modifying a template rather than achieving this with a layout change. The update shopping cart button is implemented here: https://github.com/magento/magento2/blob/9c14af7a97bcf338662de365d2613c7ca9dbf8c6/app/code/Magento/C...

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!

Re: How to add a button adjacent to Update cart button in Magento2.1 cart page?

Hi @Tom Robertshaw

 

I wanted to know it is possible without modifying or overriding cart/form.phtml as in my case  form.phtml is already overridden by another module.

 

Thanks for the answer.

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: How to add a button adjacent to Update cart button in Magento2.1 cart page?

Not without some funky CSS. You might have to overwrite the template and merge the changes you want to make with the changes made in the template change that's already there by the extension. 

----
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution" as appropriate. Thanks!