Getting Started

Deployment Deployment - Diagnose Migrations Staging

Site Management

Backups Client Reporting Passwords Plugin Automation Plugin Management - Global Plugins & Themes - Diagnose Plugins & Themes - General Plugins & Themes - Git Plugins & Themes - Logs Must Install SMTP White Label WordPress Updates

Caching & Performance

Caching Caching - Blogs/Articles Caching - Diagnose Caching - Git Caching - WooCommerce Redis Optimize & Scale

Security

Security Security - Firewall

CDN & DNS

CDN CDN - AWS CDN - Cloudflare CDN - Diagnose Domains & DNS

Server & Tools

CRON Jobs Database Debug Tool PHP Settings Redirects SEO Tools Server Errors sFTP SSL Monitoring Analytics & Logs

Staq Billing

Staq Billing > Account Staq Billing > Client Staq Billing > Setup

Media

Media Media - Diagnose Media - Optimize

Accounts & Billing

Accounts & Billing

General

WordPress Hosting Website Diagnose Troubleshoot - Other

Can certain elements be excluded from the cache?


On this page

    When operating an e-commerce website, displaying real-time updates like the cart count is crucial. However, caching a page to improve site performance can potentially make such real-time updates a challenge. Thankfully, popular e-commerce plugins, especially WooCommerce, offer a solution that addresses this exact issue.

    Understanding Ajax Cart Fragments

    Most leading e-commerce plugins, notably WooCommerce, integrate a feature known as Ajax Cart Fragments. This built-in feature ensures that certain parts of the page, like the cart icon count, are updated dynamically, even on a cached page.

    Here’s how it works:

    • When a user adds an item to the cart, instead of reloading the entire page or disabling cache, an Ajax request is triggered.
    • This Ajax request fetches only the cart count (or a fragment of the cart) and updates that specific element on the page.
    • The rest of the page remains cached and static, ensuring that website performance is maintained.

    To further illustrate this, WooCommerce’s Cart Fragments feature can be easily researched online by searching for “WC Cart Fragment Ajax“. You’ll find a plethora of documentation and user experiences that shed light on its functioning and advantages.

    Benefits of Using Ajax Cart Fragments

    1. Performance: You don’t have to compromise on the speed benefits that come with caching.
    2. Real-time Updates: Despite the page being cached, dynamic elements like the cart count remain up-to-date, ensuring a seamless user experience.
    3. Efficiency: Only the necessary part of the page is updated, rather than reloading the entire page or a large segment of it.

    Final Thoughts

    Caching is crucial for any e-commerce website aiming to provide its users with a seamless and fast experience. With the implementation of Ajax Cart Fragments, it’s easier than ever to ensure that dynamic elements like cart counts are always accurate, while still benefiting from the speed and efficiency of caching.

    Need some help?

    We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.