Magento 2 Configurable product additional plus price showing - unsure where price is coming from
-
07-03-2021 - |
题
Got a strange scenario where getting plus prices showing in configurable dropdown.
These are simples associated to a configurable product.
Not seeing anywhere where these plus prices are defined. Reverted to default template just to make sure not templating issue.
Confirmed correct price coming through on basket.
These are not the configuration prices.
Where are these prices plus (+) prices coming from?
解决方案
This is a bug introduced in https://github.com/magento/magento2/pull/17695
And fixed in https://github.com/magento/magento2/pull/22535
In our case just removed the
if (typeof allowedProducts[0] !== 'undefined' &&
typeof optionPrices[allowedProducts[0]] !== 'undefined') {
allowedProductMinPrice = this._getAllowedProductWithMinPrice(allowedProducts);
optionFinalPrice = parseFloat(optionPrices[allowedProductMinPrice].finalPrice.amount);
optionPriceDiff = optionFinalPrice - finalPrice;
if (optionPriceDiff !== 0) {
options[i].label = options[i].label + ' ' + priceUtils.formatPrice(
optionPriceDiff,
this.options.priceFormat,
true);
}
}
in theme override
/app/design/frontend/Xigen/Theme/Magento_ConfigurableProduct/web/js/configurable.js