{"id":34581,"date":"2023-08-14T05:35:34","date_gmt":"2023-08-14T05:35:34","guid":{"rendered":"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/"},"modified":"2024-07-03T04:51:13","modified_gmt":"2024-07-03T04:51:13","slug":"can-certain-elements-be-excluded-from-the-cache","status":"publish","type":"knowledgebase","link":"https:\/\/www.wpstaq.com\/gb\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/","title":{"rendered":"Can certain elements be excluded from the cache?"},"content":{"rendered":"<p>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.<\/p>\n<h2><strong>Understanding Ajax Cart Fragments<\/strong><\/h2>\n<p>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.<\/p>\n<p>Here&#8217;s how it works:<\/p>\n<ul>\n<li>When a user adds an item to the cart, instead of reloading the entire page or disabling cache, an Ajax request is triggered.<\/li>\n<li>This Ajax request fetches only the cart count (or a fragment of the cart) and updates that specific element on the page.<\/li>\n<li>The rest of the page remains cached and static, ensuring that website performance is maintained.<\/li>\n<\/ul>\n<p>To further illustrate this, WooCommerce&#8217;s Cart Fragments feature can be easily researched online by searching for &#8220;<em>WC Cart Fragment Ajax<\/em>&#8220;. You&#8217;ll find a plethora of documentation and user experiences that shed light on its functioning and advantages.<\/p>\n<h2><strong>Benefits of Using Ajax Cart Fragments<\/strong><\/h2>\n<ol>\n<li><strong>Performance<\/strong>: You don\u2019t have to compromise on the speed benefits that come with caching.<\/li>\n<li><strong>Real-time Updates<\/strong>: Despite the page being cached, dynamic elements like the cart count remain up-to-date, ensuring a seamless user experience.<\/li>\n<li><strong>Efficiency<\/strong>: Only the necessary part of the page is updated, rather than reloading the entire page or a large segment of it.<\/li>\n<\/ol>\n<h2><strong>Final Thoughts<\/strong><\/h2>\n<p>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&#8217;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.<\/p>\n","protected":false},"featured_media":0,"parent":0,"template":"","class_list":["post-34581","knowledgebase","type-knowledgebase","status-publish","hentry","categories-caching"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Can certain elements be excluded from the cache? - Managed Hosting Platform for WordPress<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Can certain elements be excluded from the cache? - Managed Hosting Platform for WordPress\" \/>\n<meta property=\"og:description\" content=\"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&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/\" \/>\n<meta property=\"og:site_name\" content=\"Managed Hosting Platform for WordPress\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/staqhosting\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-03T04:51:13+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/can-certain-elements-be-excluded-from-the-cache\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/can-certain-elements-be-excluded-from-the-cache\\\/\",\"name\":\"Can certain elements be excluded from the cache? - Managed Hosting Platform for WordPress\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\"},\"datePublished\":\"2023-08-14T05:35:34+00:00\",\"dateModified\":\"2024-07-03T04:51:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/can-certain-elements-be-excluded-from-the-cache\\\/#breadcrumb\"},\"inLanguage\":\"en-gb\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/can-certain-elements-be-excluded-from-the-cache\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/can-certain-elements-be-excluded-from-the-cache\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.wpstaq.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Can certain elements be excluded from the cache?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"name\":\"Managed Hosting Platform for WordPress\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wpstaq.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-gb\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\",\"name\":\"Staq\",\"alternateName\":\"WPStaq\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-gb\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"contentUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"width\":512,\"height\":512,\"caption\":\"Staq\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/staqhosting\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpstaq\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Can certain elements be excluded from the cache? - Managed Hosting Platform for WordPress","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/","og_locale":"en_US","og_type":"article","og_title":"Can certain elements be excluded from the cache? - Managed Hosting Platform for WordPress","og_description":"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&hellip;","og_url":"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/","og_site_name":"Managed Hosting Platform for WordPress","article_publisher":"https:\/\/www.facebook.com\/staqhosting\/","article_modified_time":"2024-07-03T04:51:13+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/","url":"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/","name":"Can certain elements be excluded from the cache? - Managed Hosting Platform for WordPress","isPartOf":{"@id":"https:\/\/www.wpstaq.com\/#website"},"datePublished":"2023-08-14T05:35:34+00:00","dateModified":"2024-07-03T04:51:13+00:00","breadcrumb":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/#breadcrumb"},"inLanguage":"en-gb","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/can-certain-elements-be-excluded-from-the-cache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.wpstaq.com\/"},{"@type":"ListItem","position":2,"name":"Can certain elements be excluded from the cache?"}]},{"@type":"WebSite","@id":"https:\/\/www.wpstaq.com\/#website","url":"https:\/\/www.wpstaq.com\/","name":"Managed Hosting Platform for WordPress","description":"","publisher":{"@id":"https:\/\/www.wpstaq.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wpstaq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-gb"},{"@type":"Organization","@id":"https:\/\/www.wpstaq.com\/#organization","name":"Staq","alternateName":"WPStaq","url":"https:\/\/www.wpstaq.com\/","logo":{"@type":"ImageObject","inLanguage":"en-gb","@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","contentUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","width":512,"height":512,"caption":"Staq"},"image":{"@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/staqhosting\/","https:\/\/www.linkedin.com\/company\/wpstaq"]}]}},"_links":{"self":[{"href":"https:\/\/www.wpstaq.com\/gb\/wp-json\/wp\/v2\/knowledgebase\/34581","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wpstaq.com\/gb\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/www.wpstaq.com\/gb\/wp-json\/wp\/v2\/types\/knowledgebase"}],"wp:attachment":[{"href":"https:\/\/www.wpstaq.com\/gb\/wp-json\/wp\/v2\/media?parent=34581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}