• Resolved Andrew1977

    (@andrew1977)


    Good Afternoon,

    We have been running with this plugin for a while, and found it very good.

    We have just added a “mini cart” to our website header, which keeps getting cached;
    and as you navigate around the site, this caching is causing the cart to display incorrect details.

    At present, the only way to stop this from happening, is to exclude the majority of the website pages from being cached.

    Is there a solution to stop the “mini cart” in the website header from being cached?

    Kind Regards,

    Andrew

Viewing 2 replies - 1 through 2 (of 2 total)
  • Raam Dev

    (@raamdev)

    Hey @andrew1977,

    Comet Cache is a page caching plugin, which means that it takes the entire contents of what WordPress generates and then caches that to a static HTML file, which is then served upon future requests to save unnecessary database and PHP requests, thereby increasing the speed of serving the page and reducing the impact on server resources.

    Since each page is cached in its entirety, it’s not possible to ‘exclude’ a specific portion of a page from the cache (e.g., the mini cart in your header). There is a technical way around this with what we call dynamic fragmentation, but there are lots of security issues related to such a feature, so we haven’t implemented it. There’s a feature request here that you can read more about this and leave a comment to show your vote for this feature if desired: https://github.com/websharks/comet-cache/issues/222

    The best way around the issue you’re having is to have the cart feature powered by JavaScript instead of PHP, that way server-side page caching has no effect on the cart. That’s how most shopping cart features are programmed. They use Client-Side JavaScript to fetch the status of the cart, thereby ensuring that the contents of the cart stay updated even if the page itself is cached. You’ll need to consult with your site developer, or with the plugin developer for the cart/theme you’re using, to see if they can update the cart to use JavaScript, which would make it compatible with WordPress caching plugins like Comet Cache.

    Thread Starter Andrew1977

    (@andrew1977)

    Good Evening,

    Many thanks for the above response.

    Just a courtesy reply to let you know that we have applied javascript to run this, and all is working well.

    Thanks again.

    Kind Regards,

    Andrew

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Mini Cart Getting Cached’ is closed to new replies.