• Hey folks,

    Thought I’d let you know about an issue with OceanWP’s infinite scroll and WooCommerce Product Recommendations.

    Every time users scroll down the page, this triggers:

    – the same Product Recommendations block to display multiple times; and
    – the newly revealed products to be injected in the Product Recommendations’ block.

    Here’s what we did to prevent this from happening:

    add_filter( 'woocommerce_product_loop_start', 'sw_prl_oceanwp_remove_inf_scroll' );
    function sw_prl_oceanwp_remove_inf_scroll( $html ) {
    
        if ( WC_PRL()->templates->get_current_deployment() ) {
            $html = str_replace( 'infinite-scroll-wrap', '', $html );
        }
    
        return $html;
    }
    
    add_filter( 'woocommerce_post_class', 'sw_prl_oceanwp_remove_item_entry' );
    function sw_prl_oceanwp_remove_item_entry( $classes ) {
    
        if ( WC_PRL()->templates->get_current_deployment() ) {
            $key = array_search( 'item-entry', $classes );
            if ( $key !== false) {
                unset( $classes[ $key ] );
            }
        }
    
        return $classes;
    }

    If anyone is experiencing the same issues, this snippet should help ??

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Infinite Scroll issues with WooCommerce Product Recommendations’ is closed to new replies.