Skip to content

Commit d794928

Browse files
committed
Resolve Virtual Quote shouldn't display "Shipping & Handling" total when Create New Order issue24212
1 parent 6f03dd3 commit d794928

File tree

1 file changed

+17
-10
lines changed
  • app/code/Magento/Quote/Model/Quote/Address/Total

1 file changed

+17
-10
lines changed

app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
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\Quote\Model\Quote\Address\Total;
710

811
use Magento\Framework\Pricing\PriceCurrencyInterface;
@@ -112,17 +115,21 @@ public function collect(
112115
*/
113116
public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
114117
{
115-
$amount = $total->getShippingAmount();
116-
$shippingDescription = $total->getShippingDescription();
117-
$title = ($shippingDescription)
118-
? __('Shipping & Handling (%1)', $shippingDescription)
119-
: __('Shipping & Handling');
118+
if (!$quote->getIsVirtual()) {
119+
$amount = $total->getShippingAmount();
120+
$shippingDescription = $total->getShippingDescription();
121+
$title = ($shippingDescription)
122+
? __('Shipping & Handling (%1)', $shippingDescription)
123+
: __('Shipping & Handling');
120124

121-
return [
122-
'code' => $this->getCode(),
123-
'title' => $title,
124-
'value' => $amount
125-
];
125+
return [
126+
'code' => $this->getCode(),
127+
'title' => $title,
128+
'value' => $amount
129+
];
130+
} else {
131+
return [];
132+
}
126133
}
127134

128135
/**

0 commit comments

Comments
 (0)