Website Building » WooCommerce » How Do I Get Rid of the Shopping Cart Icon in WooCommerce?

How Do I Get Rid of the Shopping Cart Icon in WooCommerce?

Last updated on January 21, 2023 @ 3:15 pm

If you want to get rid of the shopping cart icon in WooCommerce, there are a few ways you can do it. One way is to simply hide the icon using CSS.

Another way is to remove the cart completely from your WooCommerce store.

If you want to hide the shopping cart icon, you can do it with CSS. All you need to do is add the following code to your theme’s stylesheet:

PRO TIP: If you are using WooCommerce to sell products on your website, you may want to remove the shopping cart icon from the header of your site. This can be done by going to the WooCommerce settings page and selecting the “Disable Cart” option. However, doing this will also disable the ability to add items to the cart, so customers will not be able to purchase any products from your site.
.cart-contents, .cart-contents:hover {
    display: none;
}

This will hide the shopping cart icon from your store. If you want to remove the cart completely, you can do it with a few lines of PHP code. Add the following code to your theme’s functions.php file:

// Remove cart link from header
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
 
// Remove cart link from footer 
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 10 );  
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 20 );  

 // Remove add to cart button from product loop 
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop _add _to _cart'); 

 // Remove cross sell display 
remove action( 'WooCommerce after checkout billing','WooCommerce cross sell display');  

 // Disable stock management  (hide low stock / out of stock messages)   add filter( ‘manage _stock’, ‘__return _false’ );   WooCommerce disable add to cart    add filter ( ‘ WooCommerce _is _purchasable’ , ‘__return _false’);

This will remove the cart link from the header and footer, as well as the add to cart button from the product loop. It will also disable stock management and hide low stock / out of stock messages. If you want to keep the stock management functionality, you can remove the last line of code.

Conclusion:

There are a few different ways that you can get rid of the shopping cart icon in WooCommerce. You can either hide it using CSS or remove it completely using PHP code.

Morgan Bash

Morgan Bash

Technology enthusiast and Co-Founder of Women Coders SF.