3

I am making a store that never intends to offer gift cards.

I'm stumped how to disable the "Apply Gift Card" form on the payment step of checkout.

There isn't a clear way to do this via the admin. Disabling just the block won't also disable the JavaScript that is pulled in - and that causes other problems.

This is for Magento 2 Enterprise Edition. Disabling just the Magento_GiftCard module seems potentially problematic because of the dependencies it is involved with.

  • The only option you have is to disable that module from using command or from your config.php file there is no option to disable it from admin settings, i had same issue and endded up same result. Did contact with magento support regarding its settings they also replied same, by the way i was using magento 2.2.0 EE Cloud. – Naveed Asim Apr 4 '18 at 18:17
  • That's the problem. Properly disabling the Magento_GiftCard module via command-line ("bin/magento module:disable Magento_GiftCard") is problematic because Magento_Enterprise, Magento_GiftCardImportExport, Magento_AdvancedCheckout, Magento_MultipleWishlist, Magento_PricePermissions and Magento_GiftCardStaging all depend on it. How one does that gracefully isn't clear to me. – jschrab Apr 4 '18 at 19:08
  • Confirmed the dependencies listed in the above comment are still there in Magento 2.3.3. Wild. A simple "Enable/Disable" is what Magento needs on this. – Patrick Steil May 26 at 21:12
9

To remove this from the checkout, create a file in your theme called checkout_index_index.xml

i.e. For the checkout page: Magento_Checkout/layout/checkout_index_index.xml

Add the following to it...

<?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>
        <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="giftCardAccount" 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>
</page>

#christmastree

Don't forget to clear the cache.

The checkout is using Magento's UI components, see Magento's devdocs for more info on how to customise the checkout.

| improve this answer | |

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.