@@ -10,15 +10,13 @@ import union from 'lodash-es/union'
10
10
import { optionLabel } from '../attribute/helpers'
11
11
import i18n from '../../lib/i18n'
12
12
import { currentStoreView } from '../../lib/multistore'
13
- import * as types from '../../mutation-types'
14
13
15
14
function _filterRootProductByStockitem ( context , stockItem , product , errorCallback ) {
16
15
if ( stockItem ) {
17
16
product . stock = stockItem
18
17
if ( stockItem . is_in_stock === false ) {
19
18
product . errors . variants = i18n . t ( 'No available product variants' )
20
19
context . state . current . errors = product . errors
21
- context . commit ( types . CATALOG_SET_PRODUCT_CURRENT , product ) // just override the reference to not miss changes in the configurable_children
22
20
EventBus . $emit ( 'product-after-removevariant' , { product : product } )
23
21
if ( config . products . listOutOfStockProducts === false ) {
24
22
errorCallback ( new Error ( 'Product query returned empty result' ) )
@@ -64,11 +62,7 @@ function _filterChildrenByStockitem (context, stockItems, product, diffLog) {
64
62
context . state . current_options [ optionKey ] = optionsAvailable
65
63
}
66
64
}
67
- if ( removedOptions > 0 ) {
68
- configureProductAsync ( context , { product, configuration : context . state . current_configuration , selectDefaultVariant : true , fallbackToDefaultWhenNoAvailable : true } )
69
- } else {
70
- context . commit ( types . CATALOG_SET_PRODUCT_CURRENT , product ) // just override the reference to not miss changes in the configurable_children
71
- }
65
+ configureProductAsync ( context , { product, configuration : context . state . current_configuration , selectDefaultVariant : true , fallbackToDefaultWhenNoAvailable : true } )
72
66
if ( totalOptions === 0 ) {
73
67
product . errors . variants = i18n . t ( 'No available product variants' )
74
68
context . state . current . errors = product . errors
0 commit comments