Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
quote_with_message.php
Go to the documentation of this file.
1 <?php
8 
10 $message = $objectManager->create(\Magento\GiftMessage\Model\Message::class);
11 $message->setSender('Romeo');
12 $message->setRecipient('Mercutio');
13 $message->setMessage('I thought all for the best.');
14 $message->save();
15 
17 $quote = $objectManager->create(\Magento\Quote\Model\Quote::class);
18 $quote->setData(
19  [
20  'store_id' => 1,
21  'is_active' => 1,
22  'reserved_order_id' => 'message_order_21',
23  'gift_message_id' => $message->getId(),
24  ]
25 );
26 $quote->save();
27 
30  ->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)
31  ->create();
32 $quoteIdMask->setQuoteId($quote->getId());
33 $quoteIdMask->setDataChanges(true);
34 $quoteIdMask->save();
$objectManager