5

I made below in my theme, but new xml does not remove the git option block.

/app/design/frontend/Mytheme/themename/Magento_GiftMessage/Magento_GiftMessage/view/frontend/layout/checkout_cart_item_renderers.xml

and

/app/design/frontend/Mytheme/themename/Magento_GiftMessage/Magento_GiftMessage/view/frontend/layout/checkout_cart_index.xml

the xml is:

<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>

5 Answers 5

4

You have to use

/app/design/frontend/Mytheme/themename/Magento_GiftMessage/layout/checkout_cart_index.xml

and

/app/design/frontend/Mytheme/themename/Magento_GiftMessage/layout/checkout_cart_item_renderers.xml

use Magento_GiftMessage only once not twice and don't need view/frontend.

6
  • Does it matter which one?
    – Zinat
    Commented Nov 16, 2016 at 8:17
  • You can use checkout_cart_index.xml. Commented Nov 16, 2016 at 8:18
  • I removed the cache and deployed again, but still I see git options in cart page...So weird
    – Zinat
    Commented Nov 16, 2016 at 8:35
  • have you set proper theme? Commented Nov 16, 2016 at 8:37
  • Yes my theme works as I did other customizations, but this one :/
    – Zinat
    Commented Nov 16, 2016 at 8:38
2

If you don't need this functionallity at all, another option would be to disable the module output:

  • Just go to Stores > Configuration > Advanced > Advanced
  • Search for Magento_GiftMessage
  • Disable it and clear cache
1
  • Note to people, this sadly was removed in 2.3 - The ability to adjust modules within the Admin Backend. Has to be done via the CLI now.
    – MackieeE
    Commented Aug 12, 2019 at 16:00
2

A much better approach is simply to disable this feature rather than edit code or disable the module output.

  1. On the Admin sidebar, tap Stores. Then under Settings, choose Configuration.
  2. In the panel on the left, under Sales, choose Sales.
  3. Expand the Gift Options section.
  4. If necessary, clear the Use system value checkbox. Then, do the following: a. If the setting is for a specific store view, choose the store view where the configuration applies. b. When prompted, tap OK to continue.
  5. Set the Gift Message options according to your preference: Allow Gift Messages on Order Level Allow Gift Messages for Order Items
  6. When complete, tap Save Config.

For more details see the Magento User Guide: http://docs.magento.com/m2/ce/user_guide/sales/checkout-gift-options.html

2

For Magento 2.4.0:

In app/design/frontend/YourVendor/yourtheme/Magento_Checkout/layout/checkout_cart_index.xml

<referenceBlock name="checkout.cart.giftcardaccount" remove="true"/>
<referenceBlock name="checkout.cart.item.renderers.default.actions.gift_options" remove="true"/>
<referenceBlock name="checkout.cart.item.renderers.simple.actions.gift_options" remove="true"/>
<referenceBlock name="checkout.cart.item.renderers.bundle.actions.gift_options" remove="true"/>
<referenceBlock name="checkout.cart.item.renderers.grouped.actions.gift_options" remove="true"/>
<referenceBlock name="checkout.cart.item.renderers.configurable.actions.gift_options" remove="true"/>
<referenceBlock name="checkout.cart.item.renderers.gift-card.actions.gift_options" remove="true"/>
<referenceBlock name="checkout.cart.order.actions.gift_options" remove="true"/>
0

I would have added this as a comment on Fabian Schmengler's correct answer, but I don't have the reputation to do it. If a moderator can move this that would be great.


Another reason why this really needs to be done via the admin instead of via XML is because removing the block will cause a Javascript error. More information can be seen on here, on the Magento issues tracker.

https://github.com/magento/magento2/issues/6983

Your Answer

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

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