Skip to content

Commit 381f59a

Browse files
committed
ACP2E-1784: update qty from wishlist update to wishlist.
1 parent 0a480d7 commit 381f59a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ define([
2525
/** @inheritdoc */
2626
_create: function () {
2727
this._bind();
28+
this._triggerWishlistFormUpdate();
2829
},
2930

3031
/**
@@ -58,16 +59,22 @@ define([
5859
}
5960
}
6061
this._on(events);
61-
this._ready();
6262
},
6363

6464
/**
65-
* Update wishlist on page load
65+
* Update wishlist on page load and before submit
6666
*
6767
* @private
6868
*/
69-
_ready: function () {
69+
_triggerWishlistFormUpdate: function () {
70+
var key;
71+
7072
$(this.options.qtyInfo).trigger('change');
73+
for (key in this.options.productType) {
74+
if (this.options.productType.hasOwnProperty(key) && this.options.productType[key] + 'Info' in this.options) {
75+
$(this.options[this.options.productType[key] + 'Info']).trigger('change');
76+
}
77+
}
7178
},
7279

7380
/**
@@ -277,6 +284,8 @@ define([
277284
_validateWishlistQty: function (event) {
278285
var element = $(this.options.qtyInfo);
279286

287+
this._triggerWishlistFormUpdate();
288+
280289
if (!(element.validation() && element.validation('isValid'))) {
281290
event.preventDefault();
282291
event.stopPropagation();

0 commit comments

Comments
 (0)