6 declare(strict_types=1);
11 use Magento\Quote\Api\Data\AddressInterfaceFactory;
17 $cartRepository = Bootstrap::getObjectManager()->get(CartRepositoryInterface::class);
19 $cartManagement = Bootstrap::getObjectManager()->get(CartManagementInterface::class);
21 $addressFactory = Bootstrap::getObjectManager()->get(AddressInterfaceFactory::class);
23 $storeRepository = Bootstrap::getObjectManager()->get(StoreRepositoryInterface::class);
25 $storeManager = Bootstrap::getObjectManager()->get(StoreManagerInterface::class);
30 $cart->setCustomerIsGuest(
true);
39 AddressInterface::KEY_COUNTRY_ID =>
'US',
40 AddressInterface::KEY_REGION_ID => 15,
41 AddressInterface::KEY_LASTNAME =>
'Doe',
42 AddressInterface::KEY_FIRSTNAME =>
'John',
43 AddressInterface::KEY_STREET =>
'example street',
45 AddressInterface::KEY_CITY =>
'example city',
46 AddressInterface::KEY_TELEPHONE =>
'000 0000',
47 AddressInterface::KEY_POSTCODE => 12345
51 $cart->setReservedOrderId(
'created_order_for_test');
54 $cart->getPayment()->setMethod(
'checkmo');
55 $cart->getShippingAddress()->setShippingMethod(
'flatrate_flatrate');
56 $cart->getShippingAddress()->setCollectShippingRates(
true);
57 $cart->getShippingAddress()->collectShippingRates();