Posted on

How to Hide Price & Add to Cart Button in WooCommerce?

Hiding price in certain situations can be a boon for brands. Check out how to do it using code and some plugins.

WooCommere hide price

Last updated on June 26, 2024

We agree that nothing must be hidden from the customer. However, sometimes brands need to hide their prices while making certain changes to the website or more.

Be it running a private sale or encouraging non-members to sign up to view prices, hiding prices or the Add to Cart buttons in WooCommerce is a smart tactic that can help you reap the rewards.

But who should do it, why to do it and how to do it?

In this blog, we’ll share some code snippets in case you wish to opt for the WooCommerce hide price option for all visitors, or based on some conditions like logged-in status, and some other scenarios!

We’ll also view some plugins for it.

When to hide prices on your WooCommerce store?

There may be some situations wherein it makes sense to hide prices and Add to Cart button:

  • Wholesalers: You want to hide the price from retail customers while still allowing wholesale customers to see the prices. This is an example of showing prices only to the registered users.
  • Catalogs and pre-product launches: If you’re coming up with new products or a store, then you just want to build some buzz by showcasing your product catalog, without the price and Add to Cart button.
  • Out-of-stock items: You want to hide the prices for products that aren’t in stock and you’re not sure when they will be available next.
  • List building: Interested shoppers will contact the store for the price. This can be a way to build email lists or create a more personal connection with potential customers.
  • Offline purchases: Some sellers use the website only for marketing and advertisement of genuine products. The actual products are available at physical stores only.
  • Members-only: Create a members-only store where registered shoppers must log in to see the prices of your special membership packages. We recommend using the WooCommerce Memberships plugin to create and sell membership products in your store.

Now that we know who needs to hide prices and why, let’s take a look at how to hide them.

WooCommerce hide price – Code snippets for different scenarios

Since WooCommerce doesn’t include this feature, you need to use code snippets or some plugins.

And adding code snippets is risky. So we suggest you refer to this doc on safely adding code to your functions.php file.

Hide prices on the product pages

add_filter( 'woocommerce_get_price_html', 'storeapps_remove_price' );
function storeapps_remove_price( $price = ''){
return '';
}

Hide prices on the WooCommerce shop page only

remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );

Hide prices on all pages except WooCommerce cart and checkout page

add_filter( 'woocommerce_variable_sale_price_html', storeapps_remove_prices', 9999, 2 );

add_filter( 'woocommerce_variable_price_html', 'storeapps_remove_prices', 9999, 2 );

add_filter( 'woocommerce_get_price_html', 'storeapps_remove_prices', 9999, 2 );

function storeapps_remove_prices( $price = '', $product ) {
if ( ! is_admin() ) $price = '';
return $price;
}

Hide prices for out-of-stock items

You may want to hide prices for out-of-stock products on the shop, categories, archives, loops and single product page.

add_filter( 'woocommerce_get_price_html', 'storeapps_hide_price_if_out_stock_frontend', 9999, 2 );

function storeapps_hide_price_if_out_stock_frontend( $price = '', $product ) {
if ( is_admin() ) return $price; // return if admin dashboard
return ( ! $product->is_in_stock() ) ? apply_filters( 'woocommerce_empty_price_html', '', $product ) : $price;
}

Hide prices for logged-out users

When you want to force users to log in to view prices and add products to the cart.

add_filter( 'woocommerce_get_price_html', 'storeapps_hide_price_addcart_not_logged_in', 9999, 2 );

function storeapps_hide_price_addcart_not_logged_in( $price = '', $product ) {
if ( is_user_logged_in() ) {
return $price;
}
$price = '<div><a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ) . '">' . __( 'Login to see prices', 'storeapps' ) . '</a></div>';
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
return $price;
}

Hide prices for specific products (new launches)

You only want to hide the prices for your new launches having product IDs 303 and 609, but display the prices for the rest of the products.

add_filter( 'woocommerce_get_price_html', 'storeapps_hide_price_product_ids', 10, 2 );

function storeapps_hide_price_product_ids( $price = '', $product ) {
$hide_for_products = array( 303, 609 ); // Specify a list of product ids for which prices have to be hidden
return ( in_array( $product->get_id(), $hide_for_products ) ) ? '' : $price;
}

Hide prices for specific product categories

add_filter( 'woocommerce_get_price_html','storeapps_hide_price_on_taxonomy' );

function storeapps_hide_price_on_taxonomy( $price = '' ) {
global $product;
$hide_for_categories = array( 'posters' ); // Hide for these category slugs / IDs
return ( has_term( $hide_for_categories, 'product_cat', $product->get_id() ) ) ? '' : $price; // Don't show a price when it's in one of the categories else return the original price
}

WooCommerce hide price plugins

Plugins can undoubtedly simplify the lives of store owners and marketers who are not fond of working with code. See how these WooCommerce plugins for the add-to-cart and hide pricing can be of assistance:

WooCommerce Catalog Visibility Options

This plugin is quite popular with 10k+ active installs. It allows you to transform your WooCommerce store into a catalog by giving you the option to remove the eCommerce functionality – cart, checkout and Buy Now buttons.

Besides taking the entire store offline, you also restrict it to logged-in users. The option also allows you to configure messages to replace the price/Add to Cart button components or just remove them completely.

Key features:

  • Showcase your product images and descriptions while finalizing prices, stock or payment gateway setups.
  • Toggle product visibility on a product, category, user role or user location basis.
  • Switch between an active online store and a static product catalog.
  • Helps with hiding prices, or showing prices only to authenticated users.
  • Allows configuration of alternate price content, add-to-cart content when prices are disabled or shown only to logged-in users.
  • Hide pricing to comply with Minimum Advertised Price (MAP) rules.

Pricing: $59/year

Get Catalog Visibility Options

WooCommerce Hide Price and Add to Cart

The plugin allows you to turn your shop into an online catalog by hiding prices and adding a cart button for specific or all products and categories.

Key features:

  • Hide prices and/or Add to Cart buttons for guests and selected registered user roles.
  • Option to hide/disable Add to Cart buttons and/or prices for specific countries.
  • Replace prices with custom text and cart buttons with Contact Form 7 or custom buttons.
  • Rule-based management.

Pricing: $49/year

Get Hide Price & Add to Cart Button

YITH WooCommerce Catalog Mode

This plugin allows you to hide prices and add-to-cart buttons and create advanced calls-to-action and custom messages to boost customer interaction.

Key features:

  • Disable purchases and turn your e-commerce store into a simple online catalog.
  • Allow only registered users to make a purchase on your site.
  • Disable the Add to Cart button or the price only on specific products or categories.
  • Enable the catalog mode rules for all users or admins or only guest users.
  • Hide the Add to Cart button on all product pages or from other pages of the site (shop, category, tag pages).

Pricing: $79.99/year

Get YITH WooCommerce Catalog Mode

Conclusion

Hiding WooCommerce product prices and Add to Cart buttons help you stay in control over the products, particularly for wholesale stores, catalog sites and other cases mentioned in this blog.

We hope you find this ‘WooCommerce hide prices’ article useful. Any feedback or queries, share them below.

FAQ

Q1. How does the hide price strategy help?
The hide price strategy limits the chances of customers being caught up by surprise when they see a notable price change in the products.

Q2. What is a dummy price strategy?
Dummy pricing strategy also known as decoy strategy is when a business presents the customers with several different prices to steer them towards a particular product or service.

Q3. What is price blocking?
Price blocking also known as tiered pricing is a strategy where different prices are set for different quantities. This often results in a lower unit price for higher volumes.

2 thoughts on “How to Hide Price & Add to Cart Button in WooCommerce?

  1. I am missing an option to hide prices everywhere for everyone. This is needed when you want to show what the business offers, but need people to enquire to get quotes.

    1. Hi Rik,

      Use all the code snippets in the above article to hide prices everywhere for everyone.

      Alternatively, there are plugins available to hide prices automatically. We haven’t tried any plugin yet, so can’t recommend which one is the best.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.