2

Working to remove the Gift Card feature on Magento 2 Cart summary section. Having issue getting this working. Have created the following file:

.../app/design/frontend/***/***/Magento_Checkout/layout/checkout_cart_index.xml

The following code is not working to remove the giftcard block:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="cart.summary">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="block-giftcard" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="componentDisabled" xsi:type="boolean">true</item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
3

After reading the first proposed solution which had already been tested, searched and found the module block in gift-card-account and this is the solution in the same file I was using in my question:

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

As it may be useful for removing the gift card from the checkout page you can add/edit this file:

.../app/design/frontend/***/***/Magento_Checkout/layout/checkout_index_index.xml

with this code:

<?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>
2
  • Don't forget to remove it from the customer account page too: Remove this block via layout.xml: 'customer_account_navigation', which is originally added here: vendor/magento/module-gift-card-account/view/frontend/layout/customer_account.xml – Perry Holden Jun 21 '19 at 15:55
  • how to show gift option price on cart summary Magento 2? – Yo Yo Roshan Apr 13 '20 at 16:20
1

To remove the Gift Card Message block from the cart page I tried the layout block remove instructions but it throughs me a JS error in the console for missing gift-message component.

I found the below solutions that works for me in proper way by dislabling the gift message component for Cart page.

Create File:

app/design/frontend/{YourThemePackage}/{yourtheme}/Magento_GiftMessage/layout/checkout_cart_index.xml

Add XML instructions to disabled gift-message component:

        <?xml version="1.0"?>
    <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.cart.order.actions.gift_options">
                <arguments>
                    <argument name="jsLayout" xsi:type="array">
                        <item name="components" xsi:type="array">
                            <item name="giftOptionsCart" xsi:type="array">
                                <item name="config" xsi:type="array">
                                    <item name="componentDisabled" xsi:type="boolean">true</item>
                                </item>
                            </item>
                        </item>
                    </argument>
                </arguments>
            </referenceBlock>
        </body>
    </page>
1
  • how to show gift option price on cart summary Magento 2? – Yo Yo Roshan Apr 13 '20 at 16:20
0

The Gift Card is in module-gift-message and not in module_checkoutso :

/app/design/frontend/{Vendor}/{themeName}/Magento_GiftMessage/layout/checkout_cart_index.xml

<?xml version="1.0"?>
<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.cart.order.actions.gift_options" remove="true"/>
    </body>
</page>
2
  • Thanks for this, it helped me search in the modules to find the proper one. I'll post actual solution separately. – Joshua Fricke Sep 19 '18 at 23:11
  • how to show gift option price on cart summary Magento 2? – Yo Yo Roshan Apr 13 '20 at 16:20

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.