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? Oct 1 '19 at 8:14
  • no. I'm not override the file Oct 1 '19 at 9:08
  • write proper description then only someone can help you else everyone open a tag to close this question. Oct 1 '19 at 9:11
  • updated the question Oct 1 '19 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 Oct 1 '19 at 11:27
1

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.

1

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>

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.