_getGiftmessageSaveModel()->setGiftmessages( $this->getRequest()->getParam('giftmessage') )->saveAllInOrder(); } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while saving the gift message.')); } if ($this->getRequest()->getParam('type') == 'order_item') { $this->getResponse()->setBody($this->_getGiftmessageSaveModel()->getSaved() ? 'YES' : 'NO'); } else { $this->getResponse()->setBody(__('You saved the gift card message.')); } } }