Skip to content

Commit 47d2c31

Browse files
committed
Merge branch 'MC-41924' of https://github.com/magento-l3/magento2ce into TANGO_PR-05-11-2021_24
2 parents 4328261 + 1f39b6d commit 47d2c31

File tree

2 files changed

+85
-13
lines changed

2 files changed

+85
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontCheckoutMiniCartSubtotalMatchesAfterRemoveProductFromCartTest">
12+
<annotations>
13+
<features value="Multishipping"/>
14+
<stories value="Multiple Shipping"/>
15+
<title value="Check mini shopping cart Subtotal Price matches with the View Cart subtotal price after remove product from cart"/>
16+
<description value="Verify mini shopping cart Subtotal Price matches with the View Cart subtotal price after remove product from cart"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-42067"/>
19+
<useCaseId value="MC-41924"/>
20+
<group value="Multishipment"/>
21+
</annotations>
22+
<before>
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
25+
<createData entity="SimpleProduct" stepKey="createdSimpleProduct">
26+
<requiredEntity createDataKey="createCategory"/>
27+
</createData>
28+
<createData entity="Customer_US_UK_DE" stepKey="createCustomerWithMultipleAddresses"/>
29+
</before>
30+
<after>
31+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
32+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
33+
<deleteData createDataKey="createdSimpleProduct" stepKey="deleteCreatedSimpleProduct"/>
34+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
35+
<deleteData createDataKey="createCustomerWithMultipleAddresses" stepKey="deleteCustomer"/>
36+
</after>
37+
<!-- Login to the Storefront as created customer -->
38+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
39+
<argument name="Customer" value="$$createCustomerWithMultipleAddresses$$"/>
40+
</actionGroup>
41+
<!-- Open the simple product page -->
42+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductPage">
43+
<argument name="product" value="$$createdSimpleProduct$$"/>
44+
</actionGroup>
45+
<!-- Add to Cart three times of the product -->
46+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
47+
<actionGroup ref="AddProductWithQtyToCartFromStorefrontProductPageActionGroup" stepKey="addProductToCart">
48+
<argument name="productName" value="$$createdSimpleProduct.name$$"/>
49+
<argument name="productQty" value="3"/>
50+
</actionGroup>
51+
<waitForPageLoad time="120" stepKey="waitForAddToCart"/>
52+
<!-- Go to Cart Summary Section -->
53+
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openCart"/>
54+
<!-- Check Out with Multiple Addresses -->
55+
<actionGroup ref="StorefrontCheckoutWithMultipleAddressesActionGroup" stepKey="checkoutWithMultipleAddresses"/>
56+
<!-- Remove first simple product from cart -->
57+
<actionGroup ref="StorefrontRemoveProductOnCheckoutActionGroup" stepKey="removeFirstProductFromCart"/>
58+
<!-- Go back to the cart -->
59+
<click selector="{{MultishippingSection.back}}" stepKey="backToCart"/>
60+
<!-- Check and verify subtotals at mini cart summary section-->
61+
<waitForPageLoad time="120" stepKey="waitForCartSummaryPageToLoad"/>
62+
<grabTextFrom selector="{{CheckoutCartProductSection.productSubtotalByName($$createdSimpleProduct.name$$)}}" stepKey="grabTextFromProductsSubtotalField"/>
63+
<grabTextFrom selector="{{CheckoutCartSummarySection.subTotal}}" stepKey="grabTextFromCartSubtotalField"/>
64+
<assertEquals message="Subtotals should be equal" stepKey="assertSubtotalsFields">
65+
<expectedResult type="variable">$grabTextFromProductsSubtotalField</expectedResult>
66+
<actualResult type="variable">$grabTextFromCartSubtotalField</actualResult>
67+
</assertEquals>
68+
</test>
69+
</tests>

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -563,21 +563,24 @@ protected function processProductItems(
563563
/** @var TaxDetailsItemInterface $baseTaxDetail */
564564
$baseTaxDetail = $itemTaxDetail[self::KEY_BASE_ITEM];
565565
$quoteItem = $keyedAddressItems[$code];
566-
$this->updateItemTaxInfo($quoteItem, $taxDetail, $baseTaxDetail, $store);
567566

568-
//Update aggregated values
569-
if ($quoteItem->getHasChildren() && $quoteItem->isChildrenCalculated()) {
570-
//avoid double counting
571-
continue;
567+
if (!$quoteItem->isDeleted()) {
568+
$this->updateItemTaxInfo($quoteItem, $taxDetail, $baseTaxDetail, $store);
569+
570+
//Update aggregated values
571+
if ($quoteItem->getHasChildren() && $quoteItem->isChildrenCalculated()) {
572+
//avoid double counting
573+
continue;
574+
}
575+
$subtotal += $taxDetail->getRowTotal();
576+
$baseSubtotal += $baseTaxDetail->getRowTotal();
577+
$discountTaxCompensation += $taxDetail->getDiscountTaxCompensationAmount();
578+
$baseDiscountTaxCompensation += $baseTaxDetail->getDiscountTaxCompensationAmount();
579+
$tax += $taxDetail->getRowTax();
580+
$baseTax += $baseTaxDetail->getRowTax();
581+
$subtotalInclTax += $taxDetail->getRowTotalInclTax();
582+
$baseSubtotalInclTax += $baseTaxDetail->getRowTotalInclTax();
572583
}
573-
$subtotal += $taxDetail->getRowTotal();
574-
$baseSubtotal += $baseTaxDetail->getRowTotal();
575-
$discountTaxCompensation += $taxDetail->getDiscountTaxCompensationAmount();
576-
$baseDiscountTaxCompensation += $baseTaxDetail->getDiscountTaxCompensationAmount();
577-
$tax += $taxDetail->getRowTax();
578-
$baseTax += $baseTaxDetail->getRowTax();
579-
$subtotalInclTax += $taxDetail->getRowTotalInclTax();
580-
$baseSubtotalInclTax += $baseTaxDetail->getRowTotalInclTax();
581584
}
582585

583586
//Set aggregated values

0 commit comments

Comments
 (0)