WooCommerce Hide Price For Specific Product, Category, User Roles, Guests

Anybody who’s ever run an e-commerce store will know that pricing is everything. Prices are your best friend and worst enemy. They are the focus of your research, product comparisons, and trend analyses. For online sellers, prices make the world go around. While generally, it’s a good idea to display prices up front, sometimes the marketing strategy dictates otherwise.

There are lots of different reasons why keeping prices off the digital ‘shelves’ is a helpful move. In any case, WooCommerce doesn’t give you the option to hide prices out-of-the-box. You need to use a plugin to make these changes or manually apply code.

It’s quite common for wholesale sellers to limit the information that retail (individual, as opposed to the organization) customers can see. Often, they display prices to verified wholesale customers and hide them for casual shoppers.

 

woocommerce hide price for specific category

 

In some cases, sellers don’t want to run an e-commerce store. They might have a brick and mortar store and use the online store only for marketing purposes. This scenario may mean the seller wants to display products – items they hold in a genuine store – without attaching any prices to them.

Sometimes you just want to create a browsable catalog of products but don’t want actually to sell through the website.

Price hiding is also common on members-only websites. You can create a members-only WooCommerce store where only registered shoppers can see the price.

 

How to Hide Price in WooCommerce?

It is not hard to customize WooCommerce shop page, product page, category layout, etc. to hide prices in the WooCommerce store. The easiest way is using the plugin. But if you need more flexibility, you will most likely need to apply code.

 

1. Using Plugin

There are plugin which you can use to hide price. I will mention some of them.

 

WooCommerce Hide Price

If you would instead use plugin than manually editing files, you can use WooCommerce Hide Price Plugin: Hide Add to Cart Button & Price.

WooCommerce Hide Price plugin allows creating multiple rules which will allow to hide price and Add to Cart for non-logged in customers and other user roles. You can hide price and Add to Cart for specific products, categories, and customer Groups.

 

woocommerce hide price until login

 

You can even hide the price of specific products or the whole category for unregistered users, hide “Add to Cart” for specific user countries, etc.

WooCommerce Hide Price plugin features list:

  • Hide price and/or Add to Cart button for unregistered or registered users
  • Hide price for specific user groups, roles, and country
  • Hide price for particular products and categories
  • Create multiple rules for hiding price and Add to Cart
  • Replace price or Add to Cart with custom text
  • Option to replace Add to Cart with a link or a contact form
  • Remove add to cart button WooCommerce

 

Request a Quote Plugin

WooCommerce Request a Quote is the best alternative plugin to hide the prices from your customers according to your WooCommerce store needs. This plugin allows you to hide prices of a specific product on the shop or single product page.

 

Woosuite Request a Quote plugin.

 

You can create multiple rules based on the user role, the category, product, etc. It also comes with several other features, such as a quotation system to easily manageable quote requests.

With this helpful and multiple functionality plugin, you can hide prices on specific products or the entire products in the store. Moreover, the hiding price option is also available for the users who are not logged in to users that belong to a certain user group. Check this video to see how to hide price.

With the ‘call for price’ button, you can easily offer your customers to request a callback or even link it to the callback page and show your contact number.

WooCommerce Request a Quote plugin features list:

  • Hide/show prices for a specific product to sitewide
  • Request a quote option
  • Hide prices for users not logged in to a certain user group
  • Show’ call for price’ button
  • Link the button to the callback page or show your contact number
  • Create custom messages for quotes

 

YITH Catalog Mode

You can also use the YITH WooCommerce Catalog Mode plugin. On top of hiding the Add to Cart buttons on the pages (free version), you can also hide prices, hide the Cart & Checkout pages, target specific products, replace the price with a contact form, etc. (premium version).

 

2. Manually Hide Price

If you are willing to get your “hands dirty,” below you will find code you can apply depending on what you try to accomplish. You apply code by adding it to your functions.php file to the end of the file.

You can do this using FTP, using cPanel File Manager, or through the WordPress theme editor located at Appearance > Editor > functions.php.I recommend placing changes using your child theme.

The CSS code, on the other hand, goes in your theme style.css file. Make sure you know what you are doing when editing such files.

 

How to hide all WooCommerce prices?

This is an example of how you can hide prices for everyone. Add the below code to your functions.php file.

add_filter( ‘woocommerce_get_price_html’, function( $price ) {
if ( is_admin() ) return $price;
return ”;
} );

Using the above code, the prices will still be viewable by admin, but you can comment that line out if you want to hide prices for admins too.

 

Below code snippet hides prices on the product/archive pages, but not on the cart/checkout pages (or the cart widget). It also removes the cart item price/subtotal and the same for the checkout.

add_filter( ‘woocommerce_get_price_html’, function( $price ) {
if ( is_admin() ) return $price;
return ”;
} );
add_filter( ‘woocommerce_cart_item_price’, ‘__return_false’ );
add_filter( ‘woocommerce_cart_item_subtotal’, ‘__return_false’ );

After using this code snippet it will leave the headings in the table. These cannot be removed with a code snippet, but you can hide them with CSS.

Here’s a CSS snippet that hides the prices of the items on the cart/checkout table and the cart widget (add this to your theme style.css file):

/* Cart widget */
.woocommerce-mini-cart__total {
	display: none;
}

/* Cart */
.product-price, .product-subtotal {
	display: none !important;
}

/* Checkout */
.product-total *, th.product-total {
	display: none;
}

 

How to hide WooCommerce prices for specific user roles?

Using below code snippet you can hide the prices for all users with the ‘wholesale’ user role. Add below code to your functions.php file.

add_filter( woocommerce_get_price_html, function( $price ) {
if ( is_admin() ) return $price;
$user = wp_get_current_user();
$hide_for_roles = array( wholesale, wholesale-silver, wholesale-gold );
// If one of the user roles is in the list of roles to hide for.
if ( array_intersect( $user->roles, $hide_for_roles ) ) {
return ; // Return empty string to hide.
}
return $price; // Return original price
} );
add_filter( woocommerce_cart_item_price, __return_false );
add_filter( woocommerce_cart_item_subtotal, __return_false );

 

How to hide WooCommerce price for guest users?

To hide price for guest users you can use the following code (add below code to your functions.php file.):

add_filter( woocommerce_get_price_html, function( $price ) {
if ( ! is_user_logged_in() ) {
return ;
}
return $price; // Return original price
} );
add_filter( woocommerce_cart_item_price, __return_false );
add_filter( woocommerce_cart_item_subtotal, __return_false );

 

How to hide WooCommerce price for specific category?

Using the below code, you can hide prices for products in a particular category. Add the below code to your functions.php file.

NOTE: I have used clothes, and electronics as example in below code. Use your own name categories for which you want to hide price.

add_filter( woocommerce_get_price_html, function( $price, $product ) {
if ( is_admin() ) return $price;
// Hide for these category slugs / IDs
$hide_for_categories = array( ‘clothes, ‘electronics );
// Don’t show price when its in one of the categories
if ( has_term( $hide_for_categories, product_cat, $product->get_id() ) ) {
return ;
}
return $price; // Return original price
}, 10, 2 );
add_filter( woocommerce_cart_item_price, __return_false );
add_filter( woocommerce_cart_item_subtotal, __return_false );

 

How to hide WooCommerce price for specific product?

Using the below code, you can hide the prices for specific products based on the product ID. Add the below code to your functions.php file.

NOTE: I have added 89 and 125 as examples in the code below. Use your own product IDs. If you can’t find product ID, check my post how to find WordPress page ID where I explain how to find them.

add_filter( woocommerce_get_price_html, function( $price, $product ) {
$hide_for_products = array( 89, 125 );
if ( in_array( $product->get_id(), $hide_for_products ) ) {
return ;
}
return $price; // Return original price
}, 10, 2 );
add_filter( woocommerce_cart_item_price, __return_false );
add_filter( woocommerce_cart_item_subtotal, __return_false );

 

WooCommerce Hide Price Conclusion

Hiding prices in WooCommerce gives you more control over who has access to pricing information on your site. This is especially useful for wholesale stores, catalog sites, members-only stores, or any other situation where you wouldn’t like your products’ prices to be visible right away.

Let me know if everything worked as expected, if provided code snippets need revision or if you have other useful snippets.


DISCLOSURE: Posts may contain affiliate links. If you buy something through one of those links, I might get a small commission, without any extra cost to you. Read more about it here.

8 thoughts on “WooCommerce Hide Price For Specific Product, Category, User Roles, Guests”

  1. Nikola Durdíková

    Hey. I tried this
    /* Cart widget */
    .woocommerce-mini-cart__total {
    display: none;
    }

    /* Cart */
    .product-price, .product-subtotal {
    display: none !important;
    }

    /* Checkout */
    .product-total *, th.product-total {
    display: none;
    }
    But it doesent work. Do you know why?

    Thank

  2. Hi there, this code is working perfectly for hiding the prices, BUT I need them to show in the cart, and I just have blank spaces where the price and subtotal fields should be. Any insight on this?

  3. hi is it possible to HIDE “REGULAR” PRICE for a ROLE but KEEP the “SALES” price for that role ?

    and vice versa HIDE SALES price for a specific role but keep REGULAR price for that role ?

Leave a Comment

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

Follow on Social Media to keep up with latest content
Follow on Social Media for latest published content
Scroll to Top