@@ -360,7 +360,11 @@ define([
360360 index = 1 ,
361361 allowedProducts ,
362362 i ,
363- j ;
363+ j ,
364+ basePrice = parseFloat ( this . options . spConfig . prices . basePrice . amount ) ,
365+ optionFinalPrice ,
366+ optionPriceDiff ,
367+ optionPrices = this . options . spConfig . optionPrices ;
364368
365369 this . _clearSelect ( element ) ;
366370 element . options [ 0 ] = new Option ( '' , '' ) ;
@@ -374,6 +378,7 @@ define([
374378 if ( options ) {
375379 for ( i = 0 ; i < options . length ; i ++ ) {
376380 allowedProducts = [ ] ;
381+ optionPriceDiff = 0 ;
377382
378383 /* eslint-disable max-depth */
379384 if ( prevConfig ) {
@@ -387,14 +392,28 @@ define([
387392 }
388393 } else {
389394 allowedProducts = options [ i ] . products . slice ( 0 ) ;
395+
396+ if ( typeof allowedProducts [ 0 ] !== 'undefined' &&
397+ typeof optionPrices [ allowedProducts [ 0 ] ] !== 'undefined' ) {
398+
399+ optionFinalPrice = parseFloat ( optionPrices [ allowedProducts [ 0 ] ] . finalPrice . amount ) ;
400+ optionPriceDiff = optionFinalPrice - basePrice ;
401+
402+ if ( optionPriceDiff !== 0 ) {
403+ options [ i ] . label = options [ i ] . label + ' ' + priceUtils . formatPrice (
404+ optionPriceDiff ,
405+ this . options . priceFormat ,
406+ true ) ;
407+ }
408+ }
390409 }
391410
392411 if ( allowedProducts . length > 0 ) {
393412 options [ i ] . allowedProducts = allowedProducts ;
394413 element . options [ index ] = new Option ( this . _getOptionLabel ( options [ i ] ) , options [ i ] . id ) ;
395414
396415 if ( typeof options [ i ] . price !== 'undefined' ) {
397- element . options [ index ] . setAttribute ( 'price' , options [ i ] . prices ) ;
416+ element . options [ index ] . setAttribute ( 'price' , options [ i ] . price ) ;
398417 }
399418
400419 element . options [ index ] . config = options [ i ] ;
0 commit comments