What it does
Hide Price and Add to Cart for WooCommerce lets you hide product prices, the Add to Cart button, or both, with rules. Each rule says who it applies to (users, roles or guests) and which products (all products, or chosen products, categories, tags and brands). The price can be replaced with your own text, and the button with text or a styled link button.
Rules work on shop, category and search listings and on single product pages, for simple, variable, grouped, external and subscription products. Use it to keep prices private until buyers log in, to run a browse-only catalogue, or to send buyers to a quote or contact page.
Hide Price and Add to Cart Pro for WooCommerce is an add-on: it needs the free plugin and adds options to every rule. You can replace the button with a Contact Form 7, WPForms or Gravity Forms form, exclude roles, target countries, schedule rules and keep hidden prices out of structured data.
Where to find it: WooCommerce → Hide Price Rules
Requirements
- WordPress 6.2+ and PHP 7.4+
- WooCommerce 8.2+ (the plugin shows an admin notice and does nothing until WooCommerce is active)
- Pro: the free Hide Price and Add to Cart plugin, version 1.0.2 or newer, installed and active
- Pro, optional: Contact Form 7, WPForms or Gravity Forms for the form replacement
- Compatible with WooCommerce High-Performance Order Storage (HPOS) and the block-based Cart and Checkout
Installation
- Free: go to Plugins → Add New, search for “Hide Price and Add to Cart”, then install and activate it. You can also upload the zip under Plugins → Add New → Upload Plugin.
- Pro: keep the free plugin installed and active. Upload the Pro zip under Plugins → Add New → Upload Plugin and activate it. If the free plugin is missing, Pro shows a notice with an Install the free plugin or Activate the free plugin button.
- Pro: there is no licence key to enter. Once active, Pro adds two boxes to every rule and a Hide Price tab under WooCommerce → Settings.
Hide prices from guests
- Go to WooCommerce → Hide Price Rules and click Add New.
- Give the rule a title, for example “Guests: login to see prices”.
- In Hide price & Add to cart, tick Hide Price? and enter “Login to see prices” in Replace text with price.
- Tick Hide Add to cart?, choose Replace with custom link button, enter “Apply for an account” in Text/Button Text and your registration page URL in Custom link.
- In Users & Roles, select Guest (not logged in) under Include user roles.
- In Products & Taxonomies, tick All products.
- Click Publish, then check the shop in a private browser window.
Settings reference
| Setting | What it does | Edition |
|---|---|---|
| Hide Price? | Hides the price for the users and products the rule targets. Default: off. | Both |
| Replace text with price | Text shown instead of the price, for example “Ask for Price”. Leave empty to show nothing. | Both |
| Hide Add to cart? | Removes the Add to Cart button for the users and products the rule targets. Default: off. | Both |
| Replace add to cart options | Replace with Text, or Replace with custom link button. Pro adds Contact Form 7 form, WPForms form and Gravity Forms form under Replace with. | Both |
| Text/Button Text | The replacement text, or the link button’s label, for example “Request a Quote”. | Both |
| Custom link | The URL the link button opens. | Both |
| Button Styling | For the link button: Button CSS classes, Remove default button style, Background color, Text color, Width, Height, Padding, Margin, Border radius, Font size and Additional CSS. Unsafe CSS is removed. | Both |
| Select User(s) | Individual customers the rule applies to. | Both |
| Include user roles | Roles the rule applies to, including “Guest (not logged in)”. Leave users and roles empty to apply the rule to everyone. | Both |
| All products | Applies the rule to every product. Default: off. | Both |
| Select Products / Categories / Tags / Brands | The products the rule applies to. A product matches if it is in any of them. Brands use the product_brand taxonomy. | Both |
| Heading above the form | Optional heading shown above the replacement form. | Pro |
| Button text on shop pages | Label of the button on listings that links to the product page with the form. Default: “Enquire”. | Pro |
| Exclude user roles | Visitors with any of these roles always see the price and Add to Cart button. | Pro |
| Only these countries / Except these countries | Apply the rule only to visitors from these countries, or never to visitors from these countries. | Pro |
| Active from / Active until | Optional start and end date and time, in your site timezone. | Pro |
| Users and roles; Products and taxonomies; Visitor location | WooCommerce → Settings → Hide Price. Switch each condition type on or off. Default: all on. Switched-off conditions are ignored. | Pro |
| Remove hidden prices from structured data | WooCommerce → Settings → Hide Price. Removes the price offer from the product’s schema.org data when a rule hides the price. Default: on. | Pro |
How rules are matched
Only published rules are used. For each product, the plugin goes through the rules with Hide Price? ticked, newest first, and uses the first one whose users or roles match the visitor and whose products include the product. The Add to Cart button is handled the same way with the rules that have Hide Add to cart? ticked, so one rule can hide the price and another the button.
A rule with no users and no roles applies to everyone. A rule with All products unticked and no products, categories, tags or brands selected applies to no products. For variations, the parent product’s rules are used.
What visitors see
A hidden price is replaced with your text wherever WooCommerce prints the product price. On shop and category pages the button is replaced with your text or link button. On the product page the add-to-cart form is removed and your text or button is shown in its place; for variable products it appears in the variation area.
Hiding the button does not change whether a product can be bought, and prices are left alone in WooCommerce REST API (wc/v3) responses used by back-office tools. The Store API used by block themes is covered.
Changing the templates
Copy a template into your theme to change its markup:
- Replacement text:
yourtheme/woocommerce/wm-hide-price/text/style-one.php - Link button:
yourtheme/woocommerce/wm-hide-price/custom-link/style-one.php - Pro form:
yourtheme/woocommerce/wmhp-pro/forms/form.php - Pro shop-page button:
yourtheme/woocommerce/wmhp-pro/forms/loop-button.php
Pro: forms, countries and schedules
To use a form, tick Hide Add to cart?, then in Replace Add to Cart with a form choose the form plugin under Replace with and pick the form. Only active form plugins can be chosen. The form shows on the product page where the button was; on shop pages a button links to the product.
In Advanced conditions, logged-in customers are matched on their saved billing country and guests on WooCommerce geolocation. If the country cannot be found, an “Only these countries” rule does not apply and an “Except these countries” rule still does. The rules list gets a Pro conditions column summarising each rule.
Free and Pro compared
| Feature | Free | Pro |
|---|---|---|
| Unlimited rules | Yes | Yes |
| Hide price with replacement text | Yes | Yes |
| Replace Add to Cart with text or a styled link button | Yes | Yes |
| Target users, roles and guests | Yes | Yes |
| Target products, categories, tags and brands | Yes | Yes |
| Replace Add to Cart with a CF7, WPForms or Gravity Forms form | No | Yes |
| Exclude user roles | No | Yes |
| Include or exclude countries | No | Yes |
| Schedule rules by date and time | No | Yes |
| Remove hidden prices from structured data | No | Yes |
| Switch condition types on or off | No | Yes |
Troubleshooting
| What you see | What to do |
|---|---|
| A rule does nothing. | Check the rule is published, not a draft. Make sure Hide Price? or Hide Add to cart? is ticked, and that All products is ticked or at least one product, category, tag or brand is selected. |
| The wrong replacement text shows. | Several rules match the product. The newest published rule wins. Narrow the older or newer rule’s users, roles or products. |
| Logged-in buyers still see hidden prices, or guests see prices. | Full-page caching can serve one visitor’s page to another. Exclude shop and product pages from page caching, or use a cache that varies by login state. With Pro country rules, the cache must also vary by country. |
| The Add to Cart button is gone but nothing replaces it. | No replacement option is chosen, or the text is empty. Choose Replace with Text or Replace with custom link button and fill in Text/Button Text. |
| After removing Pro, product pages show text where the form was. | The rule still points to a form, so the free plugin shows the rule’s Text/Button Text instead. To show a link button, edit the rule and choose Replace with custom link button. |
| Pro options do not appear on the rule. | Pro needs the free plugin, version 1.0.2 or newer, to be active. Check the notice on the Plugins screen. |
| A country rule never applies to guests. | Set up geolocation under WooCommerce → Settings → General → Default customer location. Visits from 127.0.0.1 cannot be located. |
| The Brands selector says the taxonomy is not available. | The plugin uses the product_brand taxonomy. Turn on WooCommerce Brands to use it. |
For developers: hooks
Add these to a small custom plugin or your child theme’s functions.php, never to the plugin itself, so updates keep your changes.
| Hook | Type | Use it to | Edition |
|---|---|---|---|
woomanagers_replace_price_text | filter | Change the text shown instead of the price. Receives the text, rule ID and product. | Both |
woomanagers_replace_add_to_cart_text | filter | Change the text or button label shown instead of Add to Cart. Receives the text, rule ID and product. | Both |
woomanagers_custom_button_atts | filter | Change the link button’s class and style attributes. Receives the attributes array and rule ID. | Both |
wmhp_hide_price_register_post_type | filter | Change the arguments used to register the Hide Price Rules post type. | Both |
wmhp_hide_price_get_rules | filter | Change the list of published rule IDs. | Both |
wmhp_hide_price_get_price_rules | filter | Change the list of rule IDs that hide prices. | Both |
wmhp_hide_price_get_atc_rules | filter | Change the list of rule IDs that hide Add to Cart. | Both |
wmhp_should_apply_rules | filter | Turn rule processing on or off for the current request. | Both |
wmhp_price_get_template_path | filter | Change the theme folder searched for template overrides (default woocommerce/wm-hide-price/). | Both |
wmhp_price_get_default_template_path | filter | Change the plugin’s own template folder. | Both |
wmhp_after_single_add_to_cart_replacement | action | Run code after the replacement is printed on a product page. Receives the rule ID, the replacement option and the product. | Both |
wmhp_pro_loaded | action | Run code once the Pro add-on has loaded. Receives the plugin instance. | Pro |
wmhp_pro_rule_matches_visitor | filter | Have the final say on whether a rule’s Pro conditions match the visitor. Receives the decision and rule ID. | Pro |
wmhp_pro_visitor_country | filter | Override the detected visitor country (two-letter code, or empty). | Pro |
wmhp_pro_form_html | filter | Change the rendered form markup. Receives the HTML, the form plugin option and the form ID. | Pro |
wmhp_pro_form_heading | filter | Change the heading above the form. Receives the heading, rule ID and product. | Pro |
wmhp_pro_form_loop_button_text | filter | Change the shop-page button label. Receives the text, rule ID and product. | Pro |
wmhp_pro_settings | filter | Add or change fields on the WooCommerce → Settings → Hide Price tab. | Pro |
<?php
// Link the replacement price text to the My Account page for guests.
add_filter( 'woomanagers_replace_price_text', function ( $text, $rule_id, $product ) {
if ( is_user_logged_in() || '' === $text ) {
return $text;
}
return '<a href="' . esc_url( wc_get_page_permalink( 'myaccount' ) ) . '">' . esc_html( $text ) . '</a>';
}, 10, 3 );Uninstalling
Deactivating the free plugin stops every rule straight away; prices and buttons show normally again. Deactivating Pro leaves the free rules working without the Pro options.
When you click Delete for the free plugin on the Plugins screen, it asks whether to keep your data: Keep my rules leaves the Hide Price Rules and settings in the database, so reinstalling brings them back; Delete rules too removes every rule and the plugin settings. If Hide Price Pro or the B2B Managers Suite is installed, the rules are always kept, because they use them. Deleting another way (bulk delete or WP-CLI) asks nothing and keeps the data.
Deleting Pro removes the Pro options stored on each rule (form choices, excluded roles, countries and schedules) and the Visitor location and structured-data settings. Your rules and the Users and roles and Products and taxonomies switches are kept, because the free plugin still uses them.
Questions people ask
Can I hide prices only for guests?
Yes. Select “Guest (not logged in)” under Include user roles.
Can I hide prices for everyone except wholesale customers?
Leave users and roles empty so the rule applies to everyone, then in Pro add the wholesale role under Exclude user roles. In the free plugin, select every role except wholesale, plus Guest.
Can the button link to WhatsApp or a contact page?
Yes. Choose Replace with custom link button and paste the URL into Custom link.
Does it work with variable products?
Yes. Variations follow the parent product’s rules, and the replacement shows in the variation area.
Will search engines still see the price?
The free plugin changes what is displayed. Pro also removes the price from the product’s structured data when Remove hidden prices from structured data is on.
Do I need the free plugin for Pro?
Yes. Pro is an add-on and stays inactive without the free plugin, version 1.0.2 or newer.