Question

How do I remove the discount code from the cart ? There are loads of examples of how to remove it from the checkout but I also need to remove it from the cart.

Was it helpful?

Solution

app/design/frontend/{Vendor}/{theme}/Magento_Checkout/layout/checkout_cart_index.xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="cart.discount" remove="true"/>
    </body>
</page>

OTHER TIPS

create new file at app/design/frontend/{Vendor}/{theme}/Magento_Checkout/layout/checkout_cart_index.xmland paste the below contents.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <!-- remove discount form on shopping cart -->
        <referenceContainer name="checkout.cart.coupon" remove="true"/>
    </body>
</page>

flush the layout cache after doing the modification.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top