Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

findConfigurableChildAsync - fix checking stock for configurable child #2097

Merged
merged 1 commit into from
Dec 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/modules/catalog/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ export function populateProductConfigurationAsync (context, { product, selectedV
for (let option of product.configurable_options) {
let attribute_code
let attribute_label
if (option.attribute_id) {
if (option.attribute_id) {
let attr = context.rootState.attribute.list_by_id[option.attribute_id]
if (!attr) {
console.error('Wrong attribute given in configurable_options - can not find by attribute_id', option)
Expand All @@ -368,7 +368,7 @@ export function populateProductConfigurationAsync (context, { product, selectedV
} else {
if (!option.attribute_code) {
console.error('Wrong attribute given in configurable_options - no attribute_code', option)
continue
continue
} else { // we do have attribute_code!
attribute_code = option.attribute_code
attribute_label = option.frontend_label ? option.frontend_label : option.default_frontend_label
Expand Down Expand Up @@ -419,7 +419,7 @@ export function findConfigurableChildAsync({ product, configuration = null, sele

if (availabilityCheck) {
if (configurableChild.stock && !rootStore.state.config.products.listOutOfStockProducts) {
if (!configurableChild.is_in_stock) {
if (!configurableChild.stock.is_in_stock) {
return false
}
}
Expand Down Expand Up @@ -511,7 +511,7 @@ export function configureProductAsync (context, { product, configuration, select
if (selectDefaultVariant) {
context.dispatch('setCurrent', product) // without the configuration
}
}
}
return selectedVariant
} else {
if (fallbackToDefaultWhenNoAvailable) {
Expand Down