How to Hide Prices in WooCommerce
It is extremely usual for wholesalers to limit the information available to clients of retail (individual, not organization). Prices are frequently displayed for verified wholesale buyers but hidden for casual shoppers.
Sellers may not want to run an e-commerce store in some cases. They may have a physical store and only use the online store for marketing purposes. This scenario could indicate that the vendor wishes to display items that they have on hand in an actual store without assigning any prices to them.
This article will show you How to Hide Prices in WooCommerce to update your online store.
Cases to Hide Prices in WooCommerce
There are numerous scenarios in which a WooCommerce hide pricing plugin would be useful. Let’s look at a few scenarios where WooCommerce without prices makes sense:
-Stores that sell wholesale: If you run a WooCommerce wholesale business, you’ll generally want to hide the pricing from retail buyers while keeping the wholesale price visible to verified wholesale customers. You may then use WooCommerce only to show prices to registered users.
-Catalogs: You could want to present WooCommerce products without a price or an add to cart button if you merely want to establish a browsable list of products but don’t want to sell them through your website.
-Only-for-members shops: You might develop a members-only WooCommerce store, similar to a wholesale business, where registered customers must log in to see prices. You could even charge users to sign up for your store and see the prices using a WordPress membership plugin.
How to Hide Prices in WooCommerce
1. Hide Prices with code
You apply code to your functions.php file by adding it at the end of the file. This can be done through FTP, cPanel File Manager, or the WordPress theme editor Appearance > Editor > functions.php. I propose using your child theme to make modifications.
The CSS code, on the other hand, is placed in the style.css file of your theme. When changing such files, be sure you understand what you are doing.
This is an example of how everyone’s prices can be hidden. In your functions.php file, paste the following code.
add_filter( ‘woocommerce_get_price_html’, function( $price ) {
if ( is_admin() ) return $price;
return ”;
} );
The prices will still be visible to admins if you use the above code, but you can comment that line out in case you want to hide pricing for admins as well.
Prices are hidden on product/archive pages, but not on cart/checkout pages, using the code snippet below (or the cart widget). It also removes the cart item price/subtotal, as well as the checkout price/subtotal.
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’ );
Add the following CSS snippet to your theme’s style.css file to hide the pricing of the goods on the cart/checkout table and the cart widget:
/* Cart widget */
.woocommerce-mini-cart__total {
display: none;
}
/* Cart */
.product-price, .product-subtotal {
display: none !important;
}
/* Checkout */
.product-total *, th.product-total {
display: none;
}
-For specific user roles: You can hide the prices for all users with the ‘wholesale’ user role using the code snippet below. In your functions.php file, paste the following code. In the code below, we have used clothing and gadgets as examples. Use your own names for the price categories you want to hide.
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‘ );
-For guest users: You can use the following code (add it to your functions.php file) to hide the price for visitor users:
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‘ );
-For specific categories: You can hide prices for products in a specific category with the code below. In your functions.php file, paste the following code.
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‘ );
-For specific products: You can hide the prices for select products depending on the product ID using the code below. In your functions.php file, paste the following code.
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‘ );
2. Hide Prices without code
You can use WooCommerce Hide Price Plugin instead of manually modifying files if you choose. For non-logged in customers and various user roles, the WooCommerce Hide Price plugin lets you create several rules that will allow you to hide the price and Add to Cart. You can hide the pricing and Add to Cart buttons for particular products, categories, and customer groups.
You can also hide the price of certain products or the entire category for unregistered users, as well as the “Add to Cart” button for specific user nations.
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
The YITH WooCommerce Catalog Mode plugin can also be used. You may also hide prices, hide the Cart & Checkout pages, target certain products, replace the price with a contact form, and so on, in addition to hiding the Add to Cart buttons on the pages (free version) (premium version).
3 Best WooCommerce hide price plugins
1. YITH WooCommerce Catalog Mode
By removing Add to Cart buttons and any access to checkout pages, hiding product prices, and replacing them with customized buttons, text labels, and enquiry forms, YITH WooCommerce Catalog Mode lets you turn your online store into a catalogue.
If you have a large catalog of products and wish to hide the Cart button and Cart page rapidly, you may do so with a single click. When you’re ready to sell, just one more click and your catalog will be transformed into a fully functional e-commerce store.
Features:
- Enable catalog mode for all products except those on the “Exclusion List.”
- Only hide the Add to Cart button on certain products.
- Remove the Add to Cart button from the site’s other pages (shop, category, tag pages)
- Remove any references to the “Cart” and “Checkout” pages.
- Hide product prices from all users or only from guests.
Rating: 4.8/5
2. Hide Price Until Login
Until the user is not logged in or the password is entered, Hide Price Until Login in the shop and product detail pages.
Features:
- Until the right password is supplied, the product’s price is hidden.
- For certain users, it hides the product’s price.
- The price of a product is hidden until the user logs in.
- Display or hide the password field
Rating: 3.7/5
3. Catalog Visibility Options
WooCommerce is the ideal platform for displaying a catalog of products that aren’t currently available for purchase online. The added benefit of this method is that you can start selling at any time by just flipping a switch. But Catalog Visibility Options add-on accomplishes a lot more. You have the option of restricting access to people who are logged in rather than taking the entire store offline.
Features:
- Allow users to hide pricing or only see prices if they are authenticated.
- Allow users to disable e-commerce capabilities by turning off the cart.
- When prices are disabled or only shown to logged-in users, allow for selecting alternate pricing content.
- To comply with the Minimum Advertised Price (MAP) guidelines, hide prices.
Rating: 4.5/5
Conclusion
Hide prices in WooCommerce to have more control over who has access to your site’s pricing information. This is particularly handy for wholesale stores, catalog sites, members-only stores, and any other case where you don’t want the prices of your products to be displayed right away.
We hope you will find this article about How to Hide Prices in WooCommerce fundamental!