83 $messageId =
$quote->getGiftMessageId();
88 return $this->messageFactory->create()->load($messageId);
103 if (0 ==
$quote->getItemsCount()) {
104 throw new InputException(
__(
"Gift messages can't be used for an empty cart. Add an item and try again."));
107 if (
$quote->isVirtual()) {
108 throw new InvalidTransitionException(
__(
"Gift messages can't be used for virtual products."));
111 if ($messageText && !$this->helper->isMessagesAllowed(
'quote',
$quote, $this->storeManager->getStore())) {
112 throw new CouldNotSaveException(
__(
"The gift message isn't available."));
save($cartId, \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage)
__construct(\Magento\Quote\Api\CartRepositoryInterface $quoteRepository, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\GiftMessage\Model\GiftMessageManager $giftMessageManager, \Magento\GiftMessage\Helper\Message $helper, \Magento\GiftMessage\Model\MessageFactory $messageFactory)