Skip to content

Commit ba1ce66

Browse files
committed
MC-30626: Custom Option with Percent price is converted to a currency twice
1 parent 64d69ff commit ba1ce66

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

app/code/Magento/Catalog/Block/Product/View/Options/AbstractOptions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ protected function _formatPrice($value, $flag = true)
206206
}
207207
}
208208

209-
$context[CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG] = true;
209+
$context = [CustomOptionPriceInterface::CONFIGURATION_OPTION_FLAG => true];
210210
$optionAmount = $isPercent
211211
? $this->calculator->getAmount(
212212
$this->priceCurrency->roundPrice($value['pricing_value']),
213213
$this->getProduct(),
214214
null,
215215
$context
216-
): $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
216+
) : $customOptionPrice->getCustomAmount($value['pricing_value'], null, $context);
217217
$priceStr .= $this->getLayout()->getBlock('product.price.render.default')->renderAmount(
218218
$optionAmount,
219219
$customOptionPrice,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="StorefrontAssertCustomOptionCheckboxByPriceActionGroup">
11+
<actionGroup name="AssertStorefrontCustomOptionCheckboxByPriceActionGroup">
1212
<annotations>
1313
<description>Validates that the provided price for Custom Option Checkbox is present on the Storefront Product page.</description>
1414
</annotations>
1515
<arguments>
1616
<argument name="optionTitle" type="string" defaultValue="{{ProductOptionCheckbox.title}}"/>
17-
<argument name="price" type="string"/>
17+
<argument name="price" type="string" defaultValue="10"/>
1818
</arguments>
1919

2020
<seeElement selector="{{StorefrontProductInfoMainSection.productAttributeOptionsCheckbox(optionTitle, price)}}" stepKey="checkPriceProductOptionCheckbox"/>

app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckCustomOptionPriceDifferentCurrencyTest.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,29 @@
1919
<group value="catalog"/>
2020
</annotations>
2121
<before>
22-
<magentoCLI command="config:set currency/options/allow EUR,USD" stepKey="setCurrencyAllow"/>
22+
<magentoCLI command="config:set {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}},{{SetAllowedCurrenciesConfigForEUR.value}}" stepKey="setCurrencyAllow"/>
2323
<createData entity="_defaultCategory" stepKey="createCategory"/>
2424
<createData entity="_defaultProduct" stepKey="createProduct">
2525
<requiredEntity createDataKey="createCategory"/>
2626
<field key="price">10</field>
2727
</createData>
2828
<updateData createDataKey="createProduct" entity="productWithCheckbox" stepKey="updateProductWithOptions"/>
29-
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
30-
<argument name="indices" value=""/>
31-
</actionGroup>
3229
</before>
3330
<after>
34-
<magentoCLI command="config:set currency/options/allow USD" stepKey="setCurrencyAllow"/>
31+
<magentoCLI command="config:set {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}}" stepKey="setCurrencyAllow"/>
3532
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
3633
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
3734
</after>
3835
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPageOnStorefront">
3936
<argument name="product" value="$createProduct$"/>
4037
</actionGroup>
41-
<actionGroup ref="StorefrontAssertCustomOptionCheckboxByPriceActionGroup" stepKey="checkPriceProductOptionUSD">
38+
<actionGroup ref="AssertStorefrontCustomOptionCheckboxByPriceActionGroup" stepKey="checkPriceProductOptionUSD">
4239
<argument name="price" value="12.3"/>
4340
</actionGroup>
4441
<actionGroup ref="StorefrontSwitchCurrencyActionGroup" stepKey="switchEURCurrency">
4542
<argument name="currency" value="EUR"/>
4643
</actionGroup>
47-
<actionGroup ref="StorefrontAssertCustomOptionCheckboxByPriceActionGroup" stepKey="checkPriceProductOptionEUR">
44+
<actionGroup ref="AssertStorefrontCustomOptionCheckboxByPriceActionGroup" stepKey="checkPriceProductOptionEUR">
4845
<argument name="price" value="8.7"/>
4946
</actionGroup>
5047
</test>

0 commit comments

Comments
 (0)