diff --git a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js index 7b3b0c9ea0b51..e07ff337d5f1f 100644 --- a/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/web/js/add-to-wishlist.js @@ -1,13 +1,12 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2011 Adobe + * All Rights Reserved. */ define([ 'jquery', 'jquery-ui-modules/widget' ], function ($) { - 'use strict'; $.widget('mage.addToWishlist', { options: { @@ -16,7 +15,7 @@ define([ groupedInfo: '#super-product-table input', downloadableInfo: '#downloadable-links-list input', customOptionsInfo: '.product-custom-option', - qtyInfo: '#qty', + qtyInfo: 'input.qty', actionElement: '[data-action="add-to-wishlist"]', productListWrapper: '.product-item-info', productPageWrapper: '.product-info-main' @@ -293,9 +292,15 @@ define([ * @private */ _validateWishlistQty: function (event) { - var element = $(this.options.qtyInfo); + var element = $(this.options.qtyInfo), isValid = true; - if (!(element.validation() && element.validation('isValid'))) { + $(element).each(function () { + if (!($(this).validation() && $(this).validation('isValid'))) { + isValid = false; + } + }); + + if (!isValid) { event.preventDefault(); event.stopPropagation();