Skip to content

Commit 406af22

Browse files
committed
MC-18963: Bundle Product Cart Pricing issue when added a special price for associated products
1 parent c6427d1 commit 406af22

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

app/code/Magento/Bundle/Plugin/UpdatePriceInQuoteItemOptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function afterCalcRowTotal(OrigQuoteItem $subject, AbstractItem $result)
4242
{
4343
$bundleAttributes = $result->getProduct()->getCustomOption('bundle_selection_attributes');
4444
if ($bundleAttributes !== null) {
45-
$actualPrice = $result->getPrice();
45+
$actualPrice = (float)$result->getPrice();
4646
$parsedValue = $this->serializer->unserialize($bundleAttributes->getValue());
4747
if (is_array($parsedValue) && array_key_exists('price', $parsedValue)) {
4848
$parsedValue['price'] = $actualPrice;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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="SpecialPriceBundleProductInCartTest">
11+
<annotations>
12+
<features value="Bundle"/>
13+
<stories value="Check that the cart total is correct when the bundle product with special price added to the cart"/>
14+
<title value="Customer should not be able to add a Bundle Product to the cart when added a special price for associated products"/>
15+
<description value="Customer should not be able to add a Bundle Product to the cart when added a special price for associated products"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-19134"/>
18+
<group value="Bundle"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
22+
<createData entity="_defaultCategory" stepKey="category"/>
23+
<!-- Create simple product and add special price -->
24+
<createData entity="SimpleProductWithSpecialPrice" stepKey="simpleProduct">
25+
<requiredEntity createDataKey="category"/>
26+
</createData>
27+
<amOnPage url="{{AdminProductEditPage.url($simpleProduct.id$)}}" stepKey="goToAdminProductPage"/>
28+
<waitForPageLoad stepKey="waitForAdminProductPage"/>
29+
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPrice">
30+
<argument name="price" value="{{SimpleProductWithSpecialPrice.special_price}}"/>
31+
</actionGroup>
32+
<actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/>
33+
</before>
34+
<after>
35+
<!-- Delete the bundled product -->
36+
<actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid">
37+
<argument name="product" value="BundleProduct"/>
38+
</actionGroup>
39+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClearFiltersAfter"/>
40+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="logout"/>
41+
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
42+
<deleteData createDataKey="category" stepKey="deleteCategory"/>
43+
</after>
44+
<!--Go to bundle product creation page-->
45+
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage"/>
46+
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>
47+
<actionGroup ref="fillMainBundleProductForm" stepKey="fillMainFieldsForBundle"/>
48+
<!-- Add Option, a "Radio Buttons" type option -->
49+
<actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOptions">
50+
<argument name="x" value="0"/>
51+
<argument name="n" value="1"/>
52+
<argument name="prodOneSku" value="$$simpleProduct.sku$$"/>
53+
<argument name="prodTwoSku" value=""/>
54+
<argument name="optionTitle" value="Option"/>
55+
<argument name="inputType" value="radio"/>
56+
</actionGroup>
57+
<checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '0')}}" stepKey="userDefinedQuantitiyOptionProduct"/>
58+
<actionGroup ref="saveProductForm" stepKey="saveBundleProduct"/>
59+
<!-- Go to storefront BundleProduct -->
60+
<amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/>
61+
<waitForPageLoad stepKey="waitForStorefront"/>
62+
<actionGroup ref="StorefrontAddBundleProductFromProductToCartActionGroup" stepKey="addProductToCartFirstTime">
63+
<argument name="productName" value="{{BundleProduct.name}}"/>
64+
</actionGroup>
65+
<actionGroup ref="StorefrontAddBundleProductFromProductToCartActionGroup" stepKey="addProductToCartSecondTime">
66+
<argument name="productName" value="{{BundleProduct.name}}"/>
67+
</actionGroup>
68+
<click stepKey="openMiniCart" selector="{{StorefrontMinicartSection.showCart}}"/>
69+
<waitForPageLoad stepKey="waitForMiniCart"/>
70+
<see stepKey="seeCartSubtotal" userInput="$180.00"/>
71+
</test>
72+
</tests>

0 commit comments

Comments
 (0)