• Hi, the Woocommerce products I need to cache are mostly grouped products but there are thousands of products (all in one category) that I don’t need to cache. Is there any way I can exclude all the products for a specific product category?

    The previous cache plugin I used I added a filter into functions file in child theme to achieve this. Would I be able to do this with your plugin?

    Thanks

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Emre Vona

    (@emrevona)

    Is the product category name written in url?

    Thread Starter janak5

    (@janak5)

    Hi, unfortunately not.

    In the other plugin I use the author gave me this code to add to child theme to exclude:

    // Do not cache this category
    add_filter( ‘wpo_can_cache_page’, function( $can_cache_page ) {
    // If the value is already false, return it.
    if ( ! $can_cache_page ) return $can_cache_page;
    if ( has_term( ‘cobra-motorcycle’, ‘product_cat’ ) ) {
    return false;
    }
    return $can_cache_page;
    } );

    Is it possible I could do a similar thing with your plugin?

    Regards

    Plugin Author Emre Vona

    (@emrevona)

    I will think about it and let you know.

    Thread Starter janak5

    (@janak5)

    That would be great, thanks

    Thread Starter janak5

    (@janak5)

    Hi, did you think about how I could excude the products from a specific category from caching (category is cobra-motorcycle, see above). If not is it possible to point me to the part of your code that would handle this.

    Thank You

    Plugin Author Emre Vona

    (@emrevona)

    it is not possible for now. I will add a hook and people will be able to write code to exclude the pages they want.

    Thread Starter janak5

    (@janak5)

    Hi, thank you. Do you have a rough estimate of when this may be available?

    REgards

    Plugin Author Emre Vona

    (@emrevona)

    I did not start yet. but you can write it by yourself. You should write and add into the header.php file of the theme.

    if(preg_match("/something/i", $_SERVER["REQUEST_URI"])){
       echo "<!-- [wpfcNOT] -->"; 
    }
    Thread Starter janak5

    (@janak5)

    Hi, thank you, I understand the second line but for the first line how do I determine if the page is a product in a specific category. The category is not in the url.

    Regards

    Plugin Author Emre Vona

    (@emrevona)

    this is just sample code. if you know PHP and WP, you can write the code.

    Thread Starter janak5

    (@janak5)

    Hi, thank you, I believe I’ve worked it out.

    Thanks for your help.

    Regards
    Janak

    Thread Starter janak5

    (@janak5)

    Hi, I used [wpfcNOT] and a little code in header.php to exclude but the hook you mention above would be a better solution and open more possibilities to exclude things. I look forward to the hook in future release.

    Thank you for your help.

    Plugin Author Emre Vona

    (@emrevona)

    I will add

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Exclude all products from a category’ is closed to new replies.