0

I have seen many articles on how to hide the discount code on the cart page and I was able to do that, but my attempts to hide the discount code on the PAYMENT page seems to be illusive for me. What is the correct way to hide the Discount Code option on the payment page.

TIA

Jason

1

1 Answer 1

1

That are Two methods like :-

Method 1 :- you want to remove using css try this code your custom css file.

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

Method 2 :- you don't want to hide discount code using css. So try you xml file way

app/design/frontend/Vendor/theme/Magento_Checkout/layout/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>

After you change run some basic command :-

php bin/magento c:c
php bin/magento c:f

you want to get more information :-

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

THANKS.

Your Answer

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

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