Hello..,
I am getting a JS error like this after 1st product added into cart from wish list page.
jquery.yith-wcwl.js?ver=3.0.15:140 Uncaught TypeError: Cannot read property 'is_user_owner' of undefined
at HTMLBodyElement.<anonymous> (jquery.yith-wcwl.js?ver=3.0.15:140)
at HTMLDocument.dispatch (jquery.js?ver=1.12.4-wp:3)
at HTMLDocument.r.handle (jquery.js?ver=1.12.4-wp:3)
at Object.trigger (jquery.js?ver=1.12.4-wp:3)
at HTMLBodyElement.<anonymous> (jquery.js?ver=1.12.4-wp:3)
at Function.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.each (jquery.js?ver=1.12.4-wp:2)
at n.fn.init.trigger (jquery.js?ver=1.12.4-wp:3)
at Object.success (add-to-cart.js?ver=4.6.0:116)
at i (jquery.js?ver=1.12.4-wp:2)
I tried disabling all plugins except Woocommerece and YITH WooCommerce Wishlist and changing the theme but my issue is still persist. As i can see mentioned below JS in jquery.yith-wcwl.js file causes issue.
t.on( 'added_to_cart', 'body', function( ev, fragments, carthash, button ){
if( typeof button != 'undefined' && button.closest( '.wishlist_table' ).length ) {
typeof wc_add_to_cart_params !== 'undefined' && ( wc_add_to_cart_params.cart_redirect_after_add = cart_redirect_after_add );
typeof yith_wccl_general !== 'undefined' && ( yith_wccl_general.cart_redirect = cart_redirect_after_add );
var tr = button.closest('[data-row-id]'),
table = tr.closest('.wishlist-fragment'),
options = table.data('fragment-options');
button.removeClass('added');
tr.find('.added_to_cart').remove();
if ( yith_wcwl_l10n.remove_from_wishlist_after_add_to_cart && options.is_user_owner ) {
tr.remove();
}
}
} );
I update below code in plugin’s JS file
if ( yith_wcwl_l10n.remove_from_wishlist_after_add_to_cart && typeof options !== "undefined" && options.is_user_owner ) {
and issue resolved. Can you please check and update JS code in your plugin so, i can’t have to modify plugin.