• 1dejuan

    (@1dejuan)


    Hi guys, hope someone can help me out or confirm if this is how the plugin works. I am using the YITH WooCommerce Ajax Product Filter (free) for a Woo-commerce site. I am using Oxygen Builder Pro to build the site. My issue with it is that, when I use the filter, it refreshes the whole page rather than just the content. The filter works, but this makes the experiences not as seamless as I would like. I expect Ajax to only reload the filtered content, not the whole page. Is it normal for the plugin to do this ? Is there a workaround to fix this? Would love some assistance. Thanks.

    Here is the site i’m working on: https://manantialdelasflores.com/es/shop/

    I would like the whole page not to refresh when clicking on a product category filter.

    WordPress version: 6.3
    PHP: 8.0
    YITH WooCommerce Ajax Product Filter Version: 4.27.0
    Oxygen Builder Version: 4.7

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

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

    (@aranofacundo)

    Hi there,

    I hope you’re well. I checked the page you mentioned and it seems the page doesn’t have a section with the ID #content, this is why the plugin updates the entire content of the page.

    So to prevent this, please add the following PHP code in the functions.php file of your current theme:

    if( ! function_exists( 'yith_wcan_content_selector' ) ){
        function yith_wcan_content_selector( $selector ){
            $selector = '#section-4-270';
            return $selector;
        }
        add_filter( 'yith_wcan_content_selector', 'yith_wcan_content_selector' );
    } 

    Let us know if this helped you.

    Thread Starter 1dejuan

    (@1dejuan)

    Thanks @aranofacundo,

    So is the solution to add the #content ID to my template or to add the PHP code you provided into the funtion.php file? As I am using Oxygen Builder which disables the wordpress themes, will I put it into oxygen funtions.php file?

    I have other pages that use the YITH filter, how can i add multiple $selectors to the code. or do i have to just copy & paste it and change the ID?

    Appreciate the help! I’m not really a developer so my coding experience is limited.

    • This reply was modified 1 year ago by 1dejuan.
    Plugin Support Facundo Arano

    (@aranofacundo)

    Hi there,

    In this case, you can use a plugin like Code Snippets to add the PHP code to the site.

    About the selector, it should be the same in the archive pages, but if you have different layouts for the pages where the filters are displayed, then you could set a custom class or ID for the section where both the filter and products are shown and change it in PHP code.

    We’ll remain at your disposal.

    I have a question related to this topic. I also use a filter for product category pages. I have added the class .category-products to the section where both the filter and products are located. Additionally, I have inserted the following code snippet into the functions.php file:

    if( ! function_exists( 'yith_wcan_content_selector' ) ){
        function yith_wcan_content_selector( $selector ){
            $selector = '.category-products';
            return $selector;
        }
        add_filter( 'yith_wcan_content_selector', 'yith_wcan_content_selector' );
    }

    The filter works well on categories with only one page of products. However, I encounter a problem with categories that have multiple product pages. After applying the attribute filter and switching to a different page, the filter affects the content of the entire section with the ID #content, instead of just the .category-products class. Is there a way to fix this issue? Please help me. Thank you very much.

    Plugin Support Alessio Torrisi

    (@alessio91)

    Hi @homestory,

    we replied you on this topic.

    Thread Starter 1dejuan

    (@1dejuan)

    Hi @aranofacundo,

    Thanks for your support on this. Filter is working correctly however another issue I have been having is YITH does not save filter parameters when refreshing or going back on the page.

    Here is one of the pages with filtering: https://manantialdelasflores.com/productos/cuidado-corporal/

    Is there a way for it to remember the active filter when refreshing the page or going back to the page after viewing a product?

    WordPress version: 6.4.3
    PHP: 8.0.30
    YITH WooCommerce Ajax Product Filter Version: 4.31.0
    Oxygen Builder Version: 4.8.1

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘YITH WooCommerce Ajax Product Filter Reloads the whole page’ is closed to new replies.