• alexatom

    (@alexatom)


    Dear Support,

    I am using your YITH Infinite Scroll and YITH Wishlist plugins on a WordPress site with the Astra theme. On the product page, the “Add to Wishlist” button is displayed correctly on the initially loaded products. However, products loaded via Infinite Scroll do not display this button.

    I have tried resolving the issue by adding custom JavaScript to reinitialize the functionality after AJAX loading, but the button still does not appear. I also checked whether the class yith-wcwl-add-to-wishlist-button is generated for the products, but the button simply does not exist in the HTML structure of dynamically loaded products.

    This issue is critical because users cannot add products to their wishlist from the dynamically loaded products.

    I kindly request your assistance in resolving this issue or guidance on how to ensure the button is displayed and functions properly for products loaded via Infinite Scroll.

    Thank you in advance for your support!

    Best regards, Aleksa

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Facundo Arano

    (@aranofacundo)

    Hi there,

    I hope you’re well. To solve the issue you mentioned, please add the following PHP code in the functions.php file of your current theme:

    if ( ! function_exists( 'yith_infs_fix_wishlist_button_event' ) ) {
    function yith_infs_fix_wishlist_button_event() {
    $js = "jQuery( function( $ ){
    function yith_infs_fix_wishlist_button_event (){
    $( document ).trigger( 'yith_wcwl_init' );
    $( document ).trigger( 'yith_wcwl_reload_fragments' );
    wp.hooks.doAction( 'yith_wcwl_init_add_to_wishlist_components' );
    }
    $( document ).on( 'yith_infs_added_elem', yith_infs_fix_wishlist_button_event );
    } );";
    wp_add_inline_script( 'yith-infinitescroll', $js );
    }
    add_action( 'wp_enqueue_scripts', 'yith_infs_fix_wishlist_button_event', 20 );
    }

    Let us know if this helped you.

    Thread Starter alexatom

    (@alexatom)

    Hi?Facundo,

    It’s working now, thank you so much for your quick and efficient help.

    Best regards,

    Plugin Support Vanesa

    (@vanesarodriguez)

    Hello!

    I am glad my colleague Facundo helped you ??

    Please, let us know if you ever need our help again.

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.