4

On cart page I am getting this error in console:

Failed to load the "Magento_GiftMessage/js/view/gift-message" component

When I disable the module Magento_GiftMessage is working but it effect some where.

6
  • have you override this js file in your theme? Commented Oct 1, 2019 at 8:14
  • no. I'm not override the file Commented Oct 1, 2019 at 9:08
  • write proper description then only someone can help you else everyone open a tag to close this question. Commented Oct 1, 2019 at 9:11
  • updated the question Commented Oct 1, 2019 at 9:26
  • Due to Some of your custom module it is getting error, don't disable Magento_GiftMessage, enable it and try to check your custom module disable one by one Commented Oct 1, 2019 at 11:27

3 Answers 3

4

Add below code in your checkout_cart_index.xml file.

<referenceContainer name="content">
            <block class="Magento\GiftMessage\Block\Cart\GiftOptions" name="checkout.cart.order.actions.gift_options" template="Magento_GiftMessage::cart/gift_options.phtml" cacheable="false">
                <arguments>
                    <argument name="jsLayout" xsi:type="array">
                        <item name="types" xsi:type="array"/>
                        <item name="components" xsi:type="array">
                            <item name="giftOptionsCart" xsi:type="array">
                                <item name="component" xsi:type="string">Magento_GiftMessage/js/view/gift-message</item>
                                <item name="config" xsi:type="array">
                                    <item name="template" xsi:type="string">Magento_GiftMessage/gift-message</item>
                                    <item name="formTemplate" xsi:type="string">Magento_GiftMessage/gift-message-form</item>
                                </item>
                            </item>
                        </item>
                    </argument>
                </arguments>
            </block>
</referenceContainer>
1
  • Thanks, It works for me. Commented Apr 13, 2022 at 5:42
2

I had checkout_cart_index.xml copied to my theme folder and which was causing the issue, upon removing the file from theme folder it removed the error. Just copy the components from vendor to theme checkout_cart_index.xml which require changes.

0

I removed my checkout_cart_index.xml file from my theme folder and it fixed the issue.

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.