Skip to content

Commit 2d2f1e0

Browse files
author
Vaha
committed
#26240: fixed logic for getting option price index for selected swatch option
1 parent 10ab84e commit 2d2f1e0

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

app/code/Magento/Swatches/view/base/web/js/swatch-renderer.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ define([
759759

760760
$(document).trigger('updateMsrpPriceBlock',
761761
[
762-
_.findKey($widget.options.jsonConfig.index, $widget.options.jsonConfig.defaultValues),
762+
this._getSelectedOptionPriceIndex(),
763763
$widget.options.jsonConfig.optionPrices
764764
]);
765765

@@ -770,6 +770,21 @@ define([
770770
$input.trigger('change');
771771
},
772772

773+
/**
774+
* Get selected option price index
775+
*
776+
* @return {String|undefined}
777+
* @private
778+
*/
779+
_getSelectedOptionPriceIndex: function () {
780+
var allowedProduct = this._getAllowedProductWithMinPrice(this._CalcProducts());
781+
if (_.isEmpty(allowedProduct)) {
782+
return undefined;
783+
}
784+
785+
return allowedProduct;
786+
},
787+
773788
/**
774789
* Get human readable attribute code (eg. size, color) by it ID from configuration
775790
*

0 commit comments

Comments
 (0)