Remove the “Add to Cart” Feature in WooCommerce – No Plugin Needed

Sometimes, the "Add to Cart" button in WooCommerce might not align with your project's goals. If you're looking to showcase products rather than sell them directly, especially when using a WooCommerce theme, you can achieve this by adding a simple code snippet. You don't need any coding experience to perform this action.

admin
3 Min Read

Why Remove the “Add to Cart” Button?

  • Product Catalog Focus: Transform your WooCommerce store into a beautiful product catalog or showcase, ideal for portfolios, galleries, or informational sites where direct sales aren’t the primary objective.
  • Performance Optimization: Avoid using unnecessary plugins. On WordPress platforms, minimizing the number of plugins helps keep your system clean and fast.
  • Custom User Flow: Guide users to contact you directly, fill out a form, or visit a physical store, offering a tailored customer journey.

How to Remove the “Add to Cart” Button (No Plugin Required)

This method directly modifies your theme’s functions.php file, which is a powerful way to customize your site without adding extra plugin bloat.

Step 1: Access Your Theme Editor

  • From your WordPress admin dashboard, navigate to Appearance > Theme File Editor.

Step 2: Select Your Active Theme

  • In the top right corner, ensure you select your currently active theme. If you are using a child theme, it’s highly recommended to select and edit your child theme’s functions.php file to prevent your changes from being overwritten during theme updates.

Step 3: Edit the functions.php File

  • Locate and open the functions.php file from the list on the right-hand side.
  • Scroll to the very bottom of the file.
  • Add a new line, then paste the following code snippet.
  • After adding the code, click the “Update File” button to save your changes.

PHP

// Remove all variations of the "Add to Cart" button on WooCommerce pages.
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); // For Shop and Archive pages
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ); // For all single product pages
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 ); // For simple products
remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 ); // For grouped products
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20); // For variable products

This code effectively removes the “Add to Cart” and “Buy Now” buttons from all WooCommerce pages across your website. You can implement this without any prior coding experience. This non-plugin approach ensures you achieve the desired result easily and seamlessly, keeping your site lean and fast without unnecessary performance slowdowns caused by additional plugins.

Share This Article
Leave a Comment