From 0e9ff101f251d7c49ddafbc849a9caf2396ff880 Mon Sep 17 00:00:00 2001 From: Mohamed Azarudeen Date: Fri, 20 Dec 2024 10:33:30 +0530 Subject: [PATCH] Wishlist validation added for gropued product --- .../view/frontend/web/js/add-to-wishlist.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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..24b70a7d1f40d 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,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2011 Adobe + * All Rights Reserved. */ define([ @@ -16,7 +16,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 +293,14 @@ define([ * @private */ _validateWishlistQty: function (event) { - var element = $(this.options.qtyInfo); + var element = $(this.options.qtyInfo), isValid = true; + $(element).each(function () { + if (!($(this).validation() && $(this).validation('isValid'))) { + isValid = false; + } + }) - if (!(element.validation() && element.validation('isValid'))) { + if (!isValid) { event.preventDefault(); event.stopPropagation();