1

If I comment out <block class="Magento\Checkout\Block\Cart\Coupon" name="checkout.cart.coupon" as="coupon" template="cart/coupon.phtml"/> in E:\Projects\Cupolas\app\design\frontend\tv_themevast_package\default\Magento_Checkout\layout\checkout_cart_index.xml the discount code box does not show up.

But the correct way to do this is by adding <referenceBlock name="checkout.cart.coupon" remove="true"/> in E:\Projects\Cupolas\app\design\frontend\tv_themevast_package\default\Magento_Checkout\layout\checkout_index_index.xml but when I both clear the cache and deploy (though overkill) my cart still shows the discount block.

What may I be missing?

3
  • this code <referenceBlock name="checkout.cart.coupon" remove="true"/> you add your Magento_Theme folder in default.xml file – Mohit Patel Jul 10 '20 at 18:10
  • Thanks that did the trick actually – jasonhall0612 Jul 10 '20 at 18:25
  • Hello @jasonhall0612 i added answer you check – Mohit Patel Jul 10 '20 at 18:28
0

Use below CSS for hiding discount block.

.checkout-index-index .payment-option._collapsible.opc-payment-additional.discount-code {
    display: none;
}

Edit

app/code/vendor/Module/view/frontend/layout/checkout_index_index.xml

or

app/design/frontend/Vendor/theme/Magento_Checkout/layout/checkout_index_index.xml

you can also remove discount block using checkout_index_index.xml

<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.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="steps" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="billing-step" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="payment" xsi:type="array">
                                                <item name="children" xsi:type="array">
                                                    <item name="afterMethods" xsi:type="array">
                                                        <item name="children" xsi:type="array">        
                                                            <item name="discount" xsi:type="array">
                                                                <item name="config" xsi:type="array">
                                                                    <item name="componentDisabled" xsi:type="boolean">true</item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
</body>

And you Get more information check this link :-

How can i hide Discount Code form checkout payment page in Magento 2?

THANKS.

1
  • you helped answer accept the answer so useful other community thanks . – Mohit Patel Jul 12 '20 at 20:48
0

You need to create

checkout_cart_index.xml

At the following location like this :

E:\Projects\Cupolas\app\design\frontend\tv_themevast_package\default\Magento_Checkout\layout\checkout_cart_index.xml

And then add this code into that one.

<referenceBlock name="checkout.cart.coupon" remove="true"/>

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.