Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
quote_with_downloadable_product.php
Go to the documentation of this file.
1 <?php
6 require __DIR__ . '/product_downloadable.php';
7 
9 $product->load(1);
10 
13 $quote->setCustomerIsGuest(
14  true
15 )->setStoreId(
16  \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
17  \Magento\Store\Model\StoreManagerInterface::class
18  )->getStore()->getId()
19 )->setReservedOrderId(
20  'reserved_order_id_1'
21 )->setIsMultiShipping(
22  false
23 )->addProduct(
24  $product,
25  new \Magento\Framework\DataObject([
26  'links' => array_keys($product->getDownloadableLinks())
27  ])
28 );
29 $quote->collectTotals();
30 $quote->save();
31 
34  ->create(\Magento\Quote\Model\QuoteIdMaskFactory::class)
35  ->create();
36 $quoteIdMask->setQuoteId($quote->getId());
37 $quoteIdMask->setDataChanges(true);
38 $quoteIdMask->save();
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60