Support » Plugin: Cachify » Cachify HDD and Woocommerce

  • Resolved mhenschel

    (@mhenschel)


    Hello,
    I think it would be helpful to include a small section in the documentation on the functionality of Cachify (using HDD cache) when used with Woocommerce.
    A few years ago I had an issue where a customer was seeing the checkout page of a previous customer. I resolved this by adding a page id to the cache exceptions. Today I discovered that this page id must have changed at some point, so I was no longer excluding this page. However, my shop still seems to work.
    Doing some research on the web I found that Woocommerce is now putting a DONOTCACHEPAGE flag on the appropriate pages. Does this mean that Cachify is obeying this flag and I do no longer need to exclude shop pages from caching?

    In this context I’m also wondering how caching of single product pages works, because on those pages I have a dynamic side bar which shows recently viewed products and the cart content. Is this cached? If so, how would I exclude all those product pages?

    Best regards Michael

    • This topic was modified 1 year, 3 months ago by mhenschel.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Hello Michael,

    Yes, Cachify obeys this flag for some time already, so you shouldn’t need to exclude shop page(s) from caching explicitly like you used to do.

    Best regards
    Česlav

    Hi Česlav,
    thanks for your reply.
    What about dynamic side bar content on shop product pages, like cart display or recently viewed products?

    Michael

    Cachify does full page caching, so it really depends on whether the DONOTCACHEPAGE flag is set or not in such case – there is no “partial content” caching. Unfortunately, I don’t know WooCommerce that well to be able to answer you without digging into source code.

    So then I would need to know if a product page has a DONOTCACHEPAGE flag. How can I find out?

    Generally, you can tell if a page is served from cache by looking on its HTML source. Cachify appends a short HTML snippet to the end of HTML output (unless you have turned it off). Here’s an example from one of my sites:

    <!-- Cachify | http://cachify.de
    HDD Cache @ 18.04.2019 12:31:00 -->
    

    If you want to really determine whether the DONOTCACHEPAGE flag is actually set, you can add something along these lines to functions.php of your active theme:

    add_filter( 'body_class', function( $classes ) {
        if ( is_product() && defined ( 'DONOTCACHEPAGE' ) && DONOTCACHEPAGE ) {
            $classes[] = 'do-not-cache-page';
        }
        return $classes;
    }, 10, 1 );
    

    Then if <body> tag of your product pages has do-not-cache-page class set, you know the flag is active.

    Cachify appends a short HTML snippet to the end of HTML output (unless you have turned it off).

    That’s interesting. I remember that I had seen this HTML Cachify snipped in the HTML source when I had set up Cachify a few years ago. Right now I don’t see it anymore. Via ftp I can see that the pages are being cached (I use HDD caching) but I don’t get the cached pages delivered to my browser as it seems. And I wouldn’t know how to turn it off anyway.
    By the way, I have some code lines regarding Cachify added to the .htaccess file. Maybe there is a fault there. I can’t judge since I don’t understand enough of this. But I know that Cachify had been working on my sites.

    Maybe I have a conflict with a plugin. I have 4 sites running with Cachify. On one site I see the Cachify snippet in the delivered source, on the other 3 sites I don’t. The Cachify setting including the .htaccess code is identical (besides the different paths). I already tried changing themes on the sites that don’t show the cache, without success. So maybe I need to de-activate plugins now for futher testing.

    I have moved to WP-Super Cache. So this is resolved for me.
    Thanks

    Plugin Support Torsten Landsiedel

    (@zodiac1978)

    Hi @mhenschel,

    I see that you moved to another caching plugin, but maybe for other people who are finding this thread: Changing the URL from http to https needs some adjusting of the htaccess code:
    https://github.com/pluginkollektiv/cachify/wiki/en-Cache-Methods#hard-disk-hdd-cache

    Maybe this was the problem here?

    All the best,
    Torsten

    Hi Torsten,
    I had adjusted the htaccess code regarding https. And the Cachify caching had been working at some time and it still works on one of my 4 sites. No idea why it didn’t work anymore on those other 3 sites and in the end I just didn’t have the nerv to pursue this any further since the other caching plugin worked straight away.

    Thanks for your reply.
    Michael

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Cachify HDD and Woocommerce’ is closed to new replies.