How to Fix Cart Border Issues and Optimize WooCommerce Cart Snippets

running WooCommerce When on the website, merchants may encounter some interface issues such as unnecessary borders around the cart icon. Meanwhile, the WooCommerce shopping cart snippet of the Ajax Requests, while capable of dynamically updating shopping cart content, may affect page load speed on low-profile hosts. In this article, we'll provide you with a guide to removing thecartDetailed steps for borders and disabling cart snippets help optimize site performance, improve loading speeds, and ensure a smoother user experience.

图片[1]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度

Remove Cart Border

Astra Customization options are provided to adjust the style of the shopping cart icon. If you find a border around the cart icon, you can remove the border by following these steps:

图片[2]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度
  • Go to Customize Settings: from WordPress Dashboard, enter Appearance > CustomizationThe
  • Open the header builder: In the Customization panel, click Header builderThe
图片[3]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度
  • Select Shopping Cart Options: In the header builder, click cart Elements.
图片[4]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度
  • Go to the Design tab: Under the Design tab, find the Border radius option, set it to 0, or use the slider to manually enter a value.
图片[5]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度

This removes the cart icon's border and restores the page's clean design.

Disable WooCommerce Shopping Cart Snippet

WooCommerce The shopping cart clip is Ajax request for dynamically displaying the contents of the shopping cart. When a user adds items to the cart and clicks on the cart icon, the page displays the items in the cart. These requests may cause the page to take longer to load if the host is slow.

图片[6]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度

Why are shopping cart snippets disabled?

WooCommerce The shopping cart snippet feature is enabled by default to dynamically update the cart content, but on low profile hosts, using this feature may increase page load time. Disabling this feature can improve site loading speed.

Disable WooCommerce Shopping Cart Snippet

Follow the steps below to disable the WooCommerce shopping cart snippet script:

  • Go to WooCommerce Settings: from WordPress Dashboard, enter WooCommerce > SettingsClick offeringsThe
  • prohibit the use of sth. Ajax Add to cart button: Unchecked Enable Ajax Add to Cart button on product archive pageThe
图片[7]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度
  • Enable shopping cart page redirection: Check the box Jump to the shopping cart page after adding successfullyThe
图片[8]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度

This can help bypass installed cache plugins.

  • removes JavaScript: To disable the shopping cart snippet completely, add the following code snippet to the child theme's functions.php Documentation.
图片[9]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度

go into Appearance > Theme File Editor, click on the subtopic's functions.php file and paste the following code at the bottom of the file:

/** Disable Ajax calls for WooCommerce */
function sert_dequeue_woocommerce_cart_fragments() {
    wp_dequeue_script('wc-cart-fragments'); }
}
add_action( 'wp_enqueue_scripts', 'sert_dequeue_woocommerce_cart_fragments', PHP_INT_MAX); 
图片[10]-如何移除购物车边框并禁用 WooCommerce 购物车片段提升网站加载速度

This code will unload the WooCommerce Shopping cart snippet scripts that will boost your site's loading speed.

summarize

By adjusting the settings, you can easily remove the cart icon's border and disable the WooCommerce Shopping cart snippet functionality. Disabling cart snippets is especially useful for sites with slower hosts to help improve overall loading speed and performance.

Related articles


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
客服微信
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: [email protected]
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
本文作者:托尼屎大颗
THE END
If you like it, support it.
kudos285 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments