Good Evening: The event being used here is sales_order_place_after. I want to collect message our customer enter when placing the order. It is noticeable that this event doesn't handle when customer doesn't want t to leave a gift message. In this scenario, this event does nothing but ends up in a mess. Please advise

1 Answer 1


@PKTG, I seem to have had a similar issue. If you have followed the standard approach to retrieve the gift message, adding the following piece of code snippet would most likely help fix the issue. Let me know in case of any questions.

$gift_object  = $this->_orderGiftRepo->get($order->getId());
$gift_message = $gift_object->getMessage();
} catch (NoSuchEntityException $e) {
// Do nothing. No gift message specified. Valid scenario.
} catch (\Exception $e) {
$this->_logger->debug("Empty Gift Message for this order: " . $e->getMessage());
  • Approach is same. let me check this resolution. okay? Mar 23, 2020 at 12:56
  • Wonderful..It is saving much time to me. and for other future coders also. great answer. Mar 23, 2020 at 14:30

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.