Skip to content

Commit 32e7781

Browse files
committed
MC-21906: Customer cannot login after disabling a configurable product with a coupon in the cart
1 parent cc599e5 commit 32e7781

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontCustomerCheckoutDisabledProductAndCouponTest">
11+
<annotations>
12+
<features value="Checkout"/>
13+
<stories value="Checkout via the Storefront"/>
14+
<title value="Customer can login if product in his cart was disabled"/>
15+
<description value="Customer can login with disabled product in the cart and a coupon applied"/>
16+
<severity value="MINOR"/>
17+
<testCaseId value="MC-21996"/>
18+
<group value="checkout"/>
19+
</annotations>
20+
21+
<before>
22+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
24+
<requiredEntity createDataKey="createCategory"/>
25+
</createData>
26+
<createData entity="Simple_US_Customer" stepKey="createUSCustomer"/>
27+
<!-- Create sales rule with coupon -->
28+
<createData entity="SalesRuleSpecificCouponAndByPercent" stepKey="createSalesRule"/>
29+
<createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule">
30+
<requiredEntity createDataKey="createSalesRule"/>
31+
</createData>
32+
</before>
33+
<after>
34+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
35+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
<deleteData createDataKey="createUSCustomer" stepKey="deleteCustomer"/>
37+
<deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/>
38+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductListing"/>
39+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/>
40+
</after>
41+
42+
<!-- Login as Customer -->
43+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
44+
<argument name="Customer" value="$$createUSCustomer$$" />
45+
</actionGroup>
46+
47+
<!-- Add product to shopping cart -->
48+
<amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.name$$)}}" stepKey="amOnSimpleProductPage"/>
49+
<actionGroup ref="AddSimpleProductToCart" stepKey="cartAddSimpleProductToCart">
50+
<argument name="product" value="$$createSimpleProduct$$"/>
51+
<argument name="productCount" value="1"/>
52+
</actionGroup>
53+
54+
<!-- Open View and edit -->
55+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="clickMiniCart1"/>
56+
57+
<!-- Fill the Estimate Shipping and Tax section -->
58+
<actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields"/>
59+
60+
<!-- Apply Coupon -->
61+
<actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyDiscount">
62+
<argument name="coupon" value="$$createCouponForCartPriceRule$$"/>
63+
</actionGroup>
64+
65+
<!-- Sign out Customer from storefront -->
66+
<actionGroup ref="StorefrontSignOutActionGroup" stepKey="customerLogout"/>
67+
68+
<!-- Login to admin panel -->
69+
<openNewTab stepKey="openNewTab"/>
70+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
71+
72+
<!-- Find the first simple product that we just created using the product grid and go to its page-->
73+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
74+
75+
<!-- Disabled simple product from grid -->
76+
<actionGroup ref="ChangeStatusProductUsingProductGridActionGroup" stepKey="disabledProductFromGrid">
77+
<argument name="product" value="$$createSimpleProduct$$"/>
78+
<argument name="status" value="Disable"/>
79+
</actionGroup>
80+
<closeTab stepKey="closeTab"/>
81+
82+
<!-- Login as Customer -->
83+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLoginSecondTime">
84+
<argument name="Customer" value="$$createUSCustomer$$" />
85+
</actionGroup>
86+
87+
<!-- Check cart -->
88+
<click selector="{{StorefrontMiniCartSection.show}}" stepKey="clickMiniCart2"/>
89+
<dontSeeElement selector="{{StorefrontMiniCartSection.quantity}}" stepKey="dontSeeCartItem"/>
90+
</test>
91+
</tests>

app/code/Magento/Quote/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ protected function _assignProducts(): self
276276
}
277277
}
278278
if ($this->recollectQuote && $this->_quote) {
279-
$this->_quote->collectTotals();
279+
$this->_quote->setTotalsCollectedFlag(false);
280280
}
281281
\Magento\Framework\Profiler::stop('QUOTE:' . __METHOD__);
282282

0 commit comments

Comments
 (0)