• Hi, I have found what appears to be a bug in the free version of Yith WishList I think you may be interested in.

    I am performing an Ajax request on the single product page to load new upsell products after a variation change with;
    $(document).on(‘found_variation’, ‘form.cart’, function (event, variation) {
    self.getUpsells(event, variation);
    });

    As part of my getUpsells() method, I do $(document).trigger(‘yith_wcwl_reload_fragments’); to populate the add to wishlist button on the new products which is handled on line 493 of jquery.yith-wcwl.js

    load_fragments() amongst other things triggers $(document).trigger( ‘yith_wcwl_fragments_loaded’, [ fragments, data.fragments ] );

    Which in turn is handled by the following, on lines 502-504 of jquery.yith-wcwl.js;
    t.on( ‘yith_wcwl_fragments_loaded’, function( ev ){
    $( ‘.variations_form’ ).find( ‘.variations select’ ).last().change();
    } );

    The above lines seem to trigger WooCommerce to reload the variation which in turn triggers my initial method listening on “found_variation” and the whole thing goes into a loop.

    I can’t see what lines 502 to 504 are needed for and removing them does not seem to stop anything from working correctly, is it leftover code?

    Am I using the correct trigger to populate the wishlist button “yith_wcwl_reload_fragments” post ajax event

    Do you have any advice on whether or not this is the correct way to handle such an event?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there

    thank you for reporting
    We’re applying changes to this very part of the js code, because we want to reload ATW button any time a new variation is selected, in order to show proper template for currently selected variation

    Doing these changes, we ended up with the same Ajax loading loop that you described
    For this reason we slightly changed handling performed at yith_wcwl_fragments_loaded event, and we made sure to perform that handler on first page load only

    In the next version (expected for this week) you’ll find these changes, and hopefully this will help you solve your problem too

    Thread Starter nxtpixel

    (@nxtpixel)

    Hi and thank you for getting back to us so quickly.
    That’s great to know and We look forward to your plugin update; if we experience any similar issues we will let you know.

    Many thanks and best regards

    Plugin Author YITHEMES

    (@yithemes)

    Hi there

    Just a quick update to let you know that Wishlist 3.0.12 is out with the modified js
    Could you please test it and let me know?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Possible Ajax Loop Bug’ is closed to new replies.