Skip to content

Commit 5f0d845

Browse files
sync behaviour for add to cart and increments buttons with alert message appearance
1 parent 678a7fe commit 5f0d845

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

assets/js/theme/common/product-details-base.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ export function optionChangeDecorator(areDefaultOptionsSet) {
1919
return (err, response) => {
2020
const attributesData = response.data || {};
2121
const attributesContent = response.content || {};
22+
const shouldAttributesBeUpdated = true;
2223

2324
this.updateProductAttributes(attributesData);
2425
if (areDefaultOptionsSet) {
25-
this.updateView(attributesData, attributesContent, true);
26+
this.updateView(attributesData, attributesContent, shouldAttributesBeUpdated);
2627
} else {
27-
this.updateDefaultAttributesForOOS(attributesData);
28+
this.updateDefaultAttributesForOOS(attributesData, shouldAttributesBeUpdated);
2829
}
2930
};
3031
}
@@ -278,7 +279,7 @@ export default class ProductDetailsBase {
278279
viewModel.stock.$input.text(data.stock);
279280
}
280281

281-
this.updateDefaultAttributesForOOS(data);
282+
this.updateDefaultAttributesForOOS(data, shouldMessageAppear);
282283
this.updateWalletButtonsView(data);
283284

284285
// If Bulk Pricing rendered HTML is available
@@ -366,9 +367,9 @@ export default class ProductDetailsBase {
366367
}
367368
}
368369

369-
updateDefaultAttributesForOOS(data) {
370+
updateDefaultAttributesForOOS(data, shouldUpdateAttributes) {
370371
const viewModel = this.getViewModel(this.$scope);
371-
if (!data.purchasable || !data.instock) {
372+
if (shouldUpdateAttributes && (!data.purchasable || !data.instock)) {
372373
viewModel.$addToCart.prop('disabled', true);
373374
viewModel.$increments.prop('disabled', true);
374375
} else {

0 commit comments

Comments
 (0)