Skip to content

Commit 800f7ff

Browse files
Chhandak.BaruaChhandak.Barua
authored andcommitted
ACP2E-1076: Discount (Cart price rules) ignore Weee tax amount included in subtotal cart
1 parent 2902408 commit 800f7ff

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

app/code/Magento/Quote/Model/Quote/TotalsCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public function collectAddressTotals(
269269
'total' => $total
270270
]
271271
);
272-
272+
$total->setBaseSubtotalTotalInclTax($total->getBaseSubtotalInclTax());
273273
$address->addData($total->getData());
274274
$address->setAppliedTaxes($total->getAppliedTaxes());
275275
return $total;

app/code/Magento/Tax/Model/Sales/Total/Quote/CommonTaxCollector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ protected function processProductItems(
627627
$address = $shippingAssignment->getShipping()->getAddress();
628628
$address->setBaseTaxAmount($baseTax);
629629
$address->setBaseSubtotalTotalInclTax($baseSubtotalInclTax);
630+
$address->setSubtotalInclTax($subtotalInclTax);
630631
$address->setSubtotal($total->getSubtotal());
631632
$address->setBaseSubtotal($total->getBaseSubtotal());
632633

app/code/Magento/Weee/Model/Total/Quote/Weee.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,10 @@ protected function process(
242242
->setBaseWeeeTaxAppliedAmountInclTax($baseTotalValueInclTax)
243243
->setWeeeTaxAppliedRowAmountInclTax($totalRowValueInclTax)
244244
->setBaseWeeeTaxAppliedRowAmntInclTax($baseTotalRowValueInclTax);
245-
$address->setBaseSubtotalTotalInclTax($address->getBaseSubtotalTotalInclTax() + $baseTotalRowValueInclTax);
246245

247246
$this->processTotalAmount(
248247
$total,
248+
$address,
249249
$totalRowValueExclTax,
250250
$baseTotalRowValueExclTax,
251251
$totalRowValueInclTax,
@@ -259,6 +259,7 @@ protected function process(
259259
* Process row amount based on FPT total amount configuration setting
260260
*
261261
* @param Total $total
262+
* @param Address $address
262263
* @param float $rowValueExclTax
263264
* @param float $baseRowValueExclTax
264265
* @param float $rowValueInclTax
@@ -267,6 +268,7 @@ protected function process(
267268
*/
268269
protected function processTotalAmount(
269270
$total,
271+
$address,
270272
$rowValueExclTax,
271273
$baseRowValueExclTax,
272274
$rowValueInclTax,
@@ -285,6 +287,8 @@ protected function processTotalAmount(
285287
$total->setBaseSubtotalInclTax(
286288
$total->getBaseSubtotalInclTax() + $this->priceCurrency->round($baseRowValueInclTax)
287289
);
290+
$address->setBaseSubtotalTotalInclTax($total->getBaseSubtotalInclTax());
291+
$address->setSubtotalInclTax($total->getSubtotalInclTax());
288292
return $this;
289293
}
290294

app/code/Magento/Weee/Model/Total/Quote/WeeeTax.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class WeeeTax extends Weee
1818
* Collect Weee taxes amount and prepare items prices for taxation and discount
1919
*
2020
* @param Quote $quote
21-
* @param ShippingAssignmentInterface|Address $shippingAssignment
21+
* @param ShippingAssignmentInterface $shippingAssignment
2222
* @param Total $total
2323
* @return $this
2424
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -30,6 +30,7 @@ public function collect(
3030
Total $total
3131
) {
3232
AbstractTotal::collect($quote, $shippingAssignment, $total);
33+
$address = $shippingAssignment->getShipping()->getAddress();
3334
$this->_store = $quote->getStore();
3435
if (!$this->weeeData->isEnabled($this->_store)) {
3536
return $this;
@@ -47,7 +48,7 @@ public function collect(
4748
$weeeBaseTotal = $total->getWeeeBaseTotalExclTax();
4849

4950
//Add to appropriate 'subtotal' or 'weee' accumulators
50-
$this->processTotalAmount($total, $weeeTotal, $weeeBaseTotal, $weeeTotal, $weeeBaseTotal);
51+
$this->processTotalAmount($total, $address, $weeeTotal, $weeeBaseTotal, $weeeTotal, $weeeBaseTotal);
5152
return $this;
5253
}
5354

@@ -141,6 +142,7 @@ public function collect(
141142

142143
$this->processTotalAmount(
143144
$total,
145+
$address,
144146
$totalRowValueExclTax,
145147
$baseTotalRowValueExclTax,
146148
$totalRowValueInclTax,
@@ -204,6 +206,7 @@ protected function createItemToWeeeCodeMapping($weeeCodeToItemMap)
204206
* Process row amount based on FPT total amount configuration setting
205207
*
206208
* @param Total $total
209+
* @param Address $address
207210
* @param float $rowValueExclTax
208211
* @param float $baseRowValueExclTax
209212
* @param float $rowValueInclTax
@@ -212,6 +215,7 @@ protected function createItemToWeeeCodeMapping($weeeCodeToItemMap)
212215
*/
213216
protected function processTotalAmount(
214217
$total,
218+
$address,
215219
$rowValueExclTax,
216220
$baseRowValueExclTax,
217221
$rowValueInclTax,
@@ -227,6 +231,8 @@ protected function processTotalAmount(
227231

228232
$total->setSubtotalInclTax($total->getSubtotalInclTax() + $rowValueInclTax);
229233
$total->setBaseSubtotalInclTax($total->getBaseSubtotalInclTax() + $baseRowValueInclTax);
234+
$address->setBaseSubtotalTotalInclTax($total->getBaseSubtotalInclTax());
235+
$address->setSubtotalInclTax($total->getSubtotalInclTax());
230236
return $this;
231237
}
232238

0 commit comments

Comments
 (0)