{"id":1820,"date":"2024-12-17T10:47:10","date_gmt":"2024-12-17T09:47:10","guid":{"rendered":"https:\/\/wpmastertoolkit.com\/module\/desactiver-les-scripts-de-cart-fragments\/"},"modified":"2025-01-02T16:40:46","modified_gmt":"2025-01-02T15:40:46","slug":"desactiver-les-scripts-de-cart-fragments","status":"publish","type":"module","link":"https:\/\/wpmastertoolkit.com\/en\/module\/disable-cart-fragment-scripts\/","title":{"rendered":"Disable cart fragment scripts"},"content":{"rendered":"<h1 class=\"wp-block-heading\">Disable WooCommerce Cart Fragments Scripts with WPMasterToolKit<\/h1>\n\n\n\n<p>WooCommerce, one of the most popular e-commerce solutions for WordPress, uses a script called <strong>Cart Fragments<\/strong> to update the contents of the shopping cart on the front-end in real time via AJAX. While this functionality is useful for some sites, it may be superfluous for others, particularly those that don't use dynamic basket updating. In addition, this script may slow down the site by adding unnecessary AJAX requests. The module <strong>Disable Cart Fragments Scripts<\/strong> from WPMasterToolKit has been designed to solve this problem, disabling this script and optimizing your site's performance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why disable Cart Fragments scripts?<\/h2>\n\n\n\n<p>Here are the main reasons why you might want to disable this script:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Performance enhancement<\/strong> AJAX requests generated by <code data-no-auto-translation=\"\">wc-cart-fragments<\/code> can slow down initial page loading, especially on sites with a lot of traffic.<\/li>\n\n\n\n<li><strong>Simplification for sites without a dynamic shopping cart<\/strong> If your site doesn't require dynamic updating of cart contents (for example, if you redirect your customers directly to the cart page after adding a product), these scripts become unnecessary.<\/li>\n\n\n\n<li><strong>Reduce unnecessary requests<\/strong> By deactivating <code data-no-auto-translation=\"\">wc-cart-fragments<\/code>In this way, you eliminate AJAX calls that consume server resources.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">How the Disable Cart Fragments Scripts module works<\/h2>\n\n\n\n<p>The module <strong>Disable Cart Fragments Scripts<\/strong> disables WooCommerce scripts related to the dynamic shopping cart, and configures your site to avoid related functionality, such as AJAX addition to the shopping cart. Here's what it does in detail:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Disabling scripts <code data-no-auto-translation=\"\">wc-cart-fragments<\/code><\/h3>\n\n\n\n<p>The module uses the <code data-no-auto-translation=\"\">wp_enqueue_scripts<\/code> to unregister the script <code data-no-auto-translation=\"\">wc-cart-fragments<\/code>preventing it from being loaded on the front-end.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Modifying WooCommerce settings<\/h3>\n\n\n\n<p>When the module is activated, the WooCommerce settings are automatically adjusted:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Redirect after adding to cart<\/strong> Enable the option to redirect to the shopping cart page after adding a product.<\/li>\n\n\n\n<li><strong>Disable AJAX addition to basket<\/strong> Disables AJAX-based shopping cart functionality, eliminating dependency on dynamic scripting.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">WooCommerce administration<\/h3>\n\n\n\n<p>The module also includes a specific script for the WooCommerce settings page to ensure that add-to-cart behaviors are correctly configured in the administration interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Restore settings on deactivation<\/h3>\n\n\n\n<p>When the module is deactivated, it restores WooCommerce's default settings, reactivating the AJAX shopping cart functionality if necessary.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to use this module<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Installation<\/strong> : Install and activate the plugin <strong>WPMasterToolKit<\/strong> on your WordPress site.<\/li>\n\n\n\n<li><strong>Module activation<\/strong> Go to the list of modules and activate \"Disable Cart Fragments Scripts\".<\/li>\n\n\n\n<li><strong>Automatic configuration<\/strong> Once activated, the module disables scripts <code data-no-auto-translation=\"\">wc-cart-fragments<\/code> and adjusts WooCommerce settings without further intervention.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Our technical choices for this module<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Using native hooks<\/h3>\n\n\n\n<p>The module uses the <code data-no-auto-translation=\"\">wp_enqueue_scripts<\/code> to unregister dynamic scripts. This method ensures that the script is removed cleanly, with no risk of impacting other WooCommerce features.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Parameter management via activation and deactivation<\/h3>\n\n\n\n<p>By modifying the WooCommerce options on activation and deactivation, the module ensures compatibility with the default WooCommerce behavior.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Conditional loading<\/h3>\n\n\n\n<p>The module does not load any unnecessary code, in line with the WPMasterToolKit philosophy of \"one module activated = one module loaded\". Modifications apply only when the module is active.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>The module <strong>Disable Cart Fragments Scripts<\/strong> from WPMasterToolKit is an ideal solution for WooCommerce site owners looking to improve performance by removing unnecessary dynamic shopping cart scripts. Simple to use and fully automated, it guarantees a faster site without compromising user experience. Try it today to optimize your online store!<\/p>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Improve the performance of your WooCommerce store with WPMasterToolKit's Disable Cart Fragments Scripts module. By disabling unnecessary \"wc-cart-fragments\" scripts and optimizing cart settings, this module reduces AJAX requests and speeds up page loading. The ideal solution for a faster, more efficient e-commerce site!<\/p>","protected":false},"featured_media":0,"parent":0,"template":"","meta":{"_acf_changed":true,"_seopress_robots_primary_cat":"","_seopress_titles_title":"Boostez la vitesse WooCommerce: D\u00e9sactivez Cart Fragments","_seopress_titles_desc":"Boostez les performances de votre site WooCommerce en d\u00e9sactivant les scripts Cart Fragments superflus avec le module WPMasterToolKit.","_seopress_robots_index":"","_surecart_dashboard_logo_width":"180px","_surecart_dashboard_show_logo":true,"_surecart_dashboard_navigation_orders":true,"_surecart_dashboard_navigation_invoices":true,"_surecart_dashboard_navigation_subscriptions":true,"_surecart_dashboard_navigation_downloads":true,"_surecart_dashboard_navigation_billing":true,"_surecart_dashboard_navigation_account":true},"class_list":["post-1820","module","type-module","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/module\/1820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/module"}],"about":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/types\/module"}],"wp:attachment":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/media?parent=1820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}