6 declare(strict_types=1);
11 use Magento\Quote\Api\Data\AddressInterfaceFactory;
16 $cartRepository = Bootstrap::getObjectManager()->get(CartRepositoryInterface::class);
20 $cartManagement = Bootstrap::getObjectManager()->get(CartManagementInterface::class);
22 $addressFactory = Bootstrap::getObjectManager()->get(AddressInterfaceFactory::class);
25 'SKU-BUNDLE-1' => [
'qty' => 2,
'options_qty' => [3, 4]],
26 'SKU-BUNDLE-2' => [
'qty' => 3,
'options_qty' => [5, 6]]
32 $cart->setCustomerIsGuest(
true);
37 AddressInterface::KEY_COUNTRY_ID =>
'US',
38 AddressInterface::KEY_REGION_ID => 15,
39 AddressInterface::KEY_LASTNAME =>
'Doe',
40 AddressInterface::KEY_FIRSTNAME =>
'John',
41 AddressInterface::KEY_STREET =>
'example street',
43 AddressInterface::KEY_CITY =>
'example city',
44 AddressInterface::KEY_TELEPHONE =>
'000 0000',
45 AddressInterface::KEY_POSTCODE => 12345
49 $cart->setReservedOrderId(
'test_order_bundle_1');
52 $cart->getPayment()->setMethod(
'checkmo');
53 $cart->getShippingAddress()->setShippingMethod(
'flatrate_flatrate');
54 $cart->getShippingAddress()->setCollectShippingRates(
true);
55 $cart->getShippingAddress()->collectShippingRates();
65 $optionsQtyData[
$option->getId()] = $qtyData[
'options_qty'][
$i];
69 'product' =>
$product->getProductId(),
70 'qty' => $qtyData[
'qty'],
72 'bundle_option_qty' => $optionsQtyData,