Skip to content

Commit fae93e2

Browse files
committed
Resolve "Shopping Cart Summary" in backend is different from frontend, and not following the setting #25036
1 parent 0714971 commit fae93e2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Sales\Block\Adminhtml\Order\Create\Sidebar;
710

811
use Magento\Framework\Pricing\PriceCurrencyInterface;
12+
use Magento\Store\Model\ScopeInterface;
913

1014
/**
1115
* Adminhtml sales order create sidebar block
@@ -132,7 +136,20 @@ public function getItemCount()
132136
{
133137
$count = $this->getData('item_count');
134138
if ($count === null) {
135-
$count = count($this->getItems());
139+
$useQty = $this->_scopeConfig->getValue(
140+
'checkout/cart_link/use_qty',
141+
ScopeInterface::SCOPE_STORE
142+
);
143+
$allItems = $this->getItems();
144+
if ($useQty) {
145+
$count = 0;
146+
foreach ($allItems as $item) {
147+
$count += $item->getQty();
148+
}
149+
} else {
150+
$count = count($allItems);
151+
}
152+
136153
$this->setData('item_count', $count);
137154
}
138155
return $count;

0 commit comments

Comments
 (0)