Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
quote_with_check_payment.php
Go to the documentation of this file.
1 <?php
7 require 'quote_with_address.php';
12  \Magento\Quote\Model\Quote\Address\Rate::class
13 );
14 $rate->setCode('freeshipping_freeshipping');
15 $rate->getPrice(1);
16 
17 $quote->getShippingAddress()->setShippingMethod('freeshipping_freeshipping');
18 $quote->getShippingAddress()->addShippingRate($rate);
19 $quote->getPayment()->setMethod('checkmo');
20 
21 $quote->collectTotals();
22 $quote->save();
23 $quote->getPayment()->setMethod('checkmo');
24 
27  ->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)
28  ->create();
29 $quoteIdMask->setQuoteId($quote->getId());
30 $quoteIdMask->setDataChanges(true);
31 $quoteIdMask->save();
$quote