Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Multishipping
Fixtures
quote_with_split_items.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Quote\Model\Quote
;
9
10
require
__DIR__
.
'/quote.php'
;
11
16
$items
=
$quote
->getAllItems();
17
$addressList
=
$quote
->getAllShippingAddresses();
18
19
foreach
(
$addressList
as $key =>
$address
) {
20
$item
=
$items
[$key];
21
// set correct quantity per shipping address
22
$item
->setQty(1);
23
$address
->setTotalQty(1);
24
$address
->addItem(
$item
);
25
}
26
27
// assign virtual product to the billing address
28
$billingAddress
=
$quote
->getBillingAddress();
29
$virtualItem
=
$items
[
sizeof
(
$items
) - 1];
30
$billingAddress
->setTotalQty(1);
31
$billingAddress
->addItem(
$virtualItem
);
32
33
// need to recollect totals
34
$quote
->setTotalsCollectedFlag(
false
);
35
$quote
->collectTotals();
36
$quoteRepository
->save(
$quote
);
$billingAddress
foreach($addressList as $key=> $address) $billingAddress
Definition:
quote_with_split_items.php:28
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$quote
$quote
Definition:
paypal_quote.php:17
$items
$items
Definition:
quote_with_split_items.php:16
$item
$item
Definition:
partial_invoice.php:27
$address
$address
Definition:
customer.php:38
$addressList
$addressList
Definition:
quote_with_split_items.php:17
Magento\Quote\Model\Quote
Definition:
AddressTest.php:6
$quoteRepository
$quoteRepository
Definition:
paypal_quote.php:23
$virtualItem
$virtualItem
Definition:
quote_with_split_items.php:29