Magento_GiftMessage module
This module allows adding a message to an order or to each ordered item either on the frontend or on the backend.
Installation
Before installing this module, note that this module is dependent on the following modules:
Magento_CatalogMagento_SalesMagento_Quote
Before disabling or uninstalling this module, note that the Magento_GiftMessageGraphQl module depends on this module.
The Magento_GiftMessage module creates the gift_message table in the database.
This module modifies the following tables in the database:
quote- adds columngift_message_idquote_address- adds columngift_message_idquote_item- adds columngift_message_idquote_address_item- adds columngift_message_idsales_order- adds columngift_message_idsales_order_item- adds columnsgift_message_idandgift_message_available
For information about a module installation, see Enable or disable modules.
Extensibility
Extension developers can interact with the Magento_GiftMessage module. For more information about the extension mechanism, see Plugins.
The dependency injection mechanism enables you to override the functionality of the Magento_GiftMessage module.
A lot of functionality in the module is on JavaScript, use mixins to extend it.
Events
The module dispatches the following events:
-
gift_options_prepare_itemsevent in the\Magento\GiftMessage\Block\Message\Inline::getItemsmethod. Parameters:itemsis a entityItems (arraytype)
-
gift_options_prepareevent in the\Magento\GiftMessage\Block\Message\Inline::isMessagesOrderAvailablemethod. Parameters:entityis an entity object
For information about an event, see Events and observers.
Layout
This module introduces the following layouts in the view/frontend/layout and view/adminhtml/layout directories:
-
view/adminhtml/layout:sales_order_create_indexsales_order_create_load_block_datasales_order_create_load_block_itemssales_order_view
-
view/frontend/layout:checkout_cart_indexcheckout_cart_item_renderers
For more information about a layout, see the Layout documentation.
Public APIs
Data
Magento\GiftMessage\Api\Data\MessageInterface- gift message data
Cart
-
\Magento\GiftMessage\Api\CartRepositoryInterface- get the gift message by cart ID for specified shopping cart
- set the gift message for an entire shopping cart
-
\Magento\GiftMessage\Api\GuestCartRepositoryInterface- get the gift message by cart ID for specified shopping cart
- set the gift message for an entire shopping cart
Cart Item
-
\Magento\GiftMessage\Api\GuestItemRepositoryInterface- get the gift message for a specified item in a specified shopping cart
- set the gift message for a specified item in a specified shopping cart
-
\Magento\GiftMessage\Api\ItemRepositoryInterface- get the gift message for a specified item in a specified shopping cart
- set the gift message for a specified item in a specified shopping cart
Order
-
\Magento\GiftMessage\Api\OrderItemRepositoryInterface- get the gift message for a specified order
- set the gift message for an entire order
Order Item
-
\Magento\GiftMessage\Api\OrderItemRepositoryInterface- get the gift message for a specified item in a specified order
- set the gift message for a specified item in a specified order
For information about a public API, see Public interfaces & APIs.
Additional information
Learn more about Gift Options and Gift Message.
data-slots=text