PHP 8.2 security fixes end 31 Dec 2026 PHP 8.2 fixes end 31 Dec 2026 30 days left Update for $349

Documentation

Hide Price & Show Custom Button

Current version 1.1.0, released 11 Nov 2026.

Buy now, $49 a year Plugin overview

Last updated 1 Dec 2026

Hide Price & Show Custom Button hides the price, the Add to cart button or both, for the products and shoppers you choose, and puts a next step in their place: "Log in to see prices", "Call for price", an enquiry form, a popup or any link. Stores use it for wholesale catalogs, members-only prices, made-to-order products and anything they'd rather sell by enquiry. This page covers writing rules, every setting and how to stop a hidden price from showing up somewhere else. See what the plugin does.

Quick start

Hide prices from guests and show "Log in to see prices" in five steps:

  1. Go to WooCommerce > Hide Price Rules and select Add hide price rule.
  2. Give the rule a name and set Applies to to Guests (not logged in).
  3. Turn on All products in the store, or choose Categories.
  4. Turn on Hide the price and enter "Log in to see prices" in Text shown instead of the price.
  5. Select Publish, then open your shop in a private browser window to see what guests see.

The Get started with Hide Price checklist on the rules screen tracks the same steps. Select Dismiss to hide it.

Installation

Bought on wpkoders.com

  1. Sign in to your account on wpkoders.com and open Licences. Your licence key is there, and in your order email.
  2. Select Download to get the plugin zip.
  3. In WordPress, go to Plugins > Add New Plugin > Upload Plugin, choose the zip, select Install Now, then Activate.
  4. Paste your licence key when the plugin asks for it. Updates then arrive in your dashboard like any other plugin.

Bought on WooCommerce.com

  1. Buy the plugin on WooCommerce.com. It's added to your WooCommerce.com account straight away.
  2. Download the zip from My Account > Downloads on WooCommerce.com.
  3. In WordPress, go to Plugins > Add New Plugin > Upload Plugin, choose the zip, select Install Now, then Activate.
  4. Connect your store to your WooCommerce.com account (WooCommerce > Extensions), so updates arrive in your dashboard like any other plugin.

Update on a staging copy first if your store takes orders all day. Every release is listed in the changelog below.

Requirements

  • WordPress 6.5 or later.
  • WooCommerce 8.5 or later.
  • PHP 7.4 or later.
  • For rules with countries: WooCommerce geolocation, using the MaxMind integration or your CDN's country header (for example, Cloudflare). External IP lookups are only used if you allow them in the settings.

The plugin works with block themes and classic themes, the Cart and Checkout blocks, and High-Performance Order Storage (HPOS). The price text, button label, and popup content can be translated with WPML and Polylang, and a wpml-config.xml file is included.

Setup and configuration

Hide Price & Show Custom Button has three places in your dashboard:

  • WooCommerce > Hide Price Rules: your rules.
  • WooCommerce > Enquiries: enquiries sent through the built-in form.
  • WooCommerce > Settings > Hide Price: caching, geolocation, enquiry email, and uninstall options.

Hide price rules

The rules list shows who each rule applies to, its products and categories, what it does, its status (Active, Scheduled, Expired, or Draft), and its priority. Drag rules or use the arrows to change their order.

Select Add hide price rule to create one. The editor has these sections.

Who sees this rule

  • Applies to: Everyone, Guests (not logged in), or Logged-in customers.
  • Only these roles: For logged-in customers. Leave it empty for all logged-in customers.
  • Only in these countries: Leave it empty for every country. The visitor's country is detected from their IP address.
  • Start date and End date: Optional. The end date is inclusive, in your store's time zone.

Which products

  • All products in the store: Apply the rule to every product.
  • Products and Categories: A product matches when it's selected directly or is in a selected category. Variations follow their parent product.
  • Exclude products: Products this rule never affects.
  • Only these product types: Optional. Leave it empty for all types.
  • Only when stock status is: Optional. For example, choose "Out of stock" to show an enquiry button only for products you can't sell right now.

Price and add to cart

  • Hide the price: Products with a hidden price can't be purchased. Hidden prices are removed everywhere: pages, product blocks, Google structured data, the Store API, and feeds.
  • Text shown instead of the price: Simple HTML is allowed. Use {login_url} for a login link that brings shoppers back to the product. Leave it empty to show nothing.
  • Hide the add to cart button: Shows the price but stops online purchase in the shop, on product pages, and in blocks.

Custom button

  • Show a custom button: Give shoppers a next step, such as a quote request, a contact page, or a login link.
  • Button label: For example "Request a quote".
  • When clicked: Link to a URL, Open a popup with custom content, or Open the built-in enquiry form.
  • Button URL: For links. A full address (https://…), a path such as /contact/, or a mailto: or tel: link. You can use {product_id} and {product_sku}. The button is hidden while the URL is empty.
  • Popup content: For popups, text, images, or a form shortcode from your form plugin. For the built-in enquiry form, optional text shown above the form.

Priority and preview

  • Priority: When several rules match a product, the rule with the lowest number wins. You can also drag rules into order on the rules list.

The Preview box shows how a matching product looks in your shop and updates as you edit. Use View a matching product in your store to open one. Rules don't apply to you while you manage the store in the same browser if they target guests, so use a private window.

Settings

Go to WooCommerce > Settings > Hide Price.

Caching and geolocation:

  • Page caching: Let my caching plugin decide (default) or Exclude shop pages from page caches when country or role rules exist.
  • External geolocation: Allow WooCommerce to ask a third-party service for the visitor's country. It's only used by rules with countries, when the MaxMind integration or a CDN country header isn't available. It sends the visitor's IP address to an external service, so mention it in your privacy policy. Off by default.

Enquiries:

  • Send enquiries to: One or more email addresses, separated by commas. Leave it empty to use the site admin email.
  • Keep a copy: Save each enquiry under WooCommerce > Enquiries. On by default. Enquiries contain personal data and are included in WordPress personal data exports and erasures.

Uninstall:

  • Delete data on uninstall: When the plugin is deleted, also delete its rules, enquiries, and settings. Off by default.

Shortcode and getting started:

  • Enquiry form shortcode: Select Copy to copy [hpb_enquiry_form] and put the built-in enquiry form on any page, such as a "Request a quote" page.

Enquiries

Each enquiry sent through the built-in form is emailed to you and, with Keep a copy on, listed under WooCommerce > Enquiries with the product, customer, and message. Reply to the email to answer the customer.

  • Product with the price shown to logged-in customers, hidden for guests and a quote button instead

    Product with the price shown to logged-in customers, hidden for guests and a quote button instead

  • Shop products showing "Log in to see prices" and a custom button in place of the price

    Shop products showing "Log in to see prices" and a custom button in place of the price

  • Built-in enquiry form popup with name and email fields for a product

    Built-in enquiry form popup with name and email fields for a product

  • Hide price rule scheduled with a start date and an end date

    Hide price rule scheduled with a start date and an end date

How-to guides

How to hide the price until login in WooCommerce

  1. Create a rule with Applies to set to Guests (not logged in).
  2. Choose the products or categories.
  3. Turn on Hide the price and enter <a href="{login_url}">Log in to see prices</a> in Text shown instead of the price.
  4. Select Publish.

After logging in, shoppers return to the product and see the price.

How to turn on catalog mode for the whole store

  1. Create a rule with Applies to set to Everyone.
  2. Turn on All products in the store.
  3. Turn on Hide the add to cart button (and Hide the price if you don't want to show prices).
  4. Optional: add a custom button, such as "Contact us", with Link to a URL.

How to replace the add to cart button with a request a quote button

  1. In the rule, turn on Hide the add to cart button and Show a custom button.
  2. Enter a Button label, such as "Request a quote".
  3. Set When clicked to Open the built-in enquiry form.
  4. Check the recipient in WooCommerce > Settings > Hide Price > Send enquiries to.

Shoppers get a form with their name, email, phone (optional), and message, and the product is included automatically.

How to show call for price on out-of-stock products

  1. Create a rule for Everyone with All products in the store.
  2. Set Only when stock status is to Out of stock.
  3. Turn on Hide the add to cart button, and optionally Hide the price with the text "Call for price".
  4. Add a custom button with Link to a URL and a tel: link, or the built-in enquiry form.

How to hide prices by country or for a limited time

  1. Choose the countries in Only in these countries.
  2. Optional: set a Start date and End date.
  3. If you use full-page caching, set Page caching to exclude shop pages in the settings.

Video

Plays from YouTube (privacy-enhanced mode) when you press play. Captions are on in the player.
  1. WooCommerce hide price for guests
  2. Rules: who, what and when
  3. Custom button and enquiry form
  4. Try it risk-free for 30 days
Read the transcript

Hide your prices from guests, and turn visits into enquiries. Right now, anyone can see your trade prices. Show your prices only to the right people. Set rules for guests, customers, roles, countries, or between two dates. Hide the price, the add to cart button, or both, and show your own text. Guests see a log-in link that brings them right back to the product. Logged-in customers see prices, and buy as usual. A custom button opens the built-in enquiry form, right where they shop. Every enquiry is emailed to you, and kept in one list. Your prices stay protected, and more shoppers start a conversation. Hide Price and Show Custom Button, by WPKoders. Try it risk-free for 30 days on WooCommerce.com. Your success, koded.

Frequently asked questions

Is the price really hidden, or just covered up?

It's removed from the page source, structured data, the Store API, variation data, and feeds. Restricted products can't be added to the cart by any route, including add-to-cart links, AJAX, the Store API, and the block checkout.

Can I show "Log in to see prices"?

Yes. Create a rule for guests, hide the price, and use the text <a href="{login_url}">Log in to see prices</a>. After logging in, shoppers return to the product.

Where do enquiries go?

To the email addresses in Send enquiries to (the site admin email by default). A copy is kept under WooCommerce > Enquiries unless you turn Keep a copy off.

Does it work with page caching?

Rules for guests and logged-in customers are cache-safe when your cache skips logged-in users, which most caching plugins do by default. For country rules, exclude shop pages from your page cache or set Page caching to exclude them.

Does it work with block themes and the block checkout?

Yes. Prices are hidden in product blocks and the Store API, the custom button appears in the Product Collection block and the Single Product template, and restricted products can't be bought through the block checkout. The legacy All Products block hides prices but doesn't show the custom button.

Can I use my own contact form in the popup?

Yes. Set When clicked to Open a popup with custom content and paste your form plugin's shortcode into Popup content.

Troubleshooting

I hid the price but I still see it

Rules for guests don't apply while you're logged in. Open your shop in a private browser window. Also check that the rule is published and, if it has dates, that today is between them.

Country rules don't work

The visitor's country can't be detected. Set up the MaxMind integration in WooCommerce or use a CDN that sends a country header. A notice in the settings tells you when countries can't be detected. As a last resort, allow External geolocation.

The custom button doesn't show

For Link to a URL, the button is hidden until you enter a valid Button URL. The rule editor shows a message when a URL isn't saved.

Shoppers see another visitor's prices

A full-page cache is sharing pages between visitors with different rules. Exclude shop pages from the cache or set Page caching to exclude them.

Known limitations

  • On shop and category archive pages in block themes, products can show the custom button twice (one styled and one plain). Product Collection blocks on regular pages show it once.
  • On single product pages in block themes, the custom button doesn't use the theme's button style.
  • The legacy All Products block doesn't show the custom button.

Developer notes

Shortcode

[hpb_enquiry_form] shows the built-in enquiry form on any page. It uses the enquiry settings.

Filters

  • hpb_product_rule ($rule, $product): The rule applied to a product.
  • hpb_rules_apply ($apply): Whether rules apply in the current request.
  • hpb_custom_button_html ($html, $product, $rule, $context): The custom button HTML.
  • hpb_popup_rules ($popups): The rules that output a popup on the page.
  • hpb_hide_price_allowed_tags ($allowed_html): HTML allowed in the price text.
  • hpb_visitor_country ($country): The visitor's country.
  • hpb_has_local_geolocation ($has): Whether local geolocation is available.
  • hpb_has_visitor_dependent_rules ($dependent): Whether rules depend on the visitor.
  • hpb_prevent_page_cache ($shop_page): Whether to exclude the page from page caches.
  • hpb_enqueue_frontend_assets ($enqueue): Load the front-end assets on every page.
  • hpb_enquiry_email_recipient ($list, $data): The enquiry email recipients.
  • hpb_enquiry_is_spam ($is_spam, $data): Mark an enquiry as spam.
  • hpb_enquiry_rate_limit ($limit): Enquiries allowed per visitor in a short time. Default 5.
  • hpb_rule_capability ($capability): The capability needed to manage rules. Default manage_woocommerce.
  • hpb_settings ($settings): The plugin settings.

Actions

  • hpb_enquiry_submitted ($enquiry_id, $data): After an enquiry is sent.
  • hpb_rules_refreshed ($guest_rules, $registered_rules): After the rules cache is rebuilt.

Works great with

  • Quote Offer: when customers should request a quote that you answer, negotiate, and turn into an order. Use one plugin per product.
  • B2B Pricing: give logged-in trade customers their own prices once they can see them.
  • Restrict Checkout: checkout rules such as minimum orders, regions, and payment methods.
  • Multistep Product Bundles: let customers build their own box from the products you do sell online.

Support

Bought here, using the free Lite version, or a question before buying? Open a ticket with us: the developers who wrote the plugin reply within 1 business day.

Open a ticket

Bought on WooCommerce.com? Open your ticket in your WooCommerce.com account, where your licence is.

Changelog

Version 1.1.0
  • Improved Now requires WordPress 6.5 or later and WooCommerce 8.5 or later.
  • New Built-in "Request a quote" enquiry form (custom button option and [hpb_enquiry_form] shortcode). Emails you the product and customer details, keeps a log under WooCommerce > Enquiries, spam protection, privacy export/erase.
  • New Custom button in block themes and block grids (Product Collection, Single Product template, Add to Cart with Options).
  • New "Everyone" audience, so one rule covers guests and logged-in customers.
  • New Schedule rules with start and end dates.
  • New Apply rules only to certain product types or stock statuses (e.g. an enquiry button for out-of-stock products).
  • New Drag and drop (and keyboard) ordering of rule priority on the rules list.
  • New "Log in to see prices": simple HTML in the price text and a {login_url} placeholder that brings shoppers back to the product. {product_sku} placeholder for button URLs.
  • New WooCommerce > Settings > Hide Price: enquiry email, page caching, external geolocation and opt-in "Delete data on uninstall" (off by default).
  • New WPML String Translation and Polylang support for the price text, button label, URL and popup.
  • Improved New rule editor with sections, conditional fields, live preview and validation; clearer rules list (who, products, what it does, status); getting-started checklist, empty states and help links (WPKoders admin design system).
  • Improved The popup is now an accessible dialog (keyboard, focus handling, Esc, screen-reader labels); RTL-friendly styles.
  • Improved Scripts and styles load only on pages that show a custom button (no jQuery on the storefront); popup content no longer runs the full the_content filter stack; rule lists are read once per request.
  • Improved Countries are detected without third-party IP lookups on new installs (existing stores keep their previous behaviour; configurable).
  • Fixed Rule changes made by bulk edit, scheduled publishing, imports or permanent deletion now take effect immediately.
  • Fixed Popup content keeps images, lists and form-plugin markup (Contact Form 7, WPForms…); shortcodes run after filtering.
  • Fixed The popup stylesheet no longer changes box-sizing site-wide.
  • Fixed Variable products whose price is hidden show the custom button on the product page and no longer say "out of stock".
  • Fixed Invalid button URLs are rejected with a clear message; link buttons without a URL are no longer printed; the default button label is "Request a quote".
  • Improved Tested up to WordPress 7.1 and WooCommerce 11.2.
Version 1.0.4
  • Security Products whose add-to-cart is hidden can no longer be bought by other routes (add-to-cart links, AJAX, the Store API / block checkout), including their variations.
  • Security "Hide price" now removes the price everywhere: page source, structured data (Google rich results), the Store API, variation data and product feeds, not just the visible price.
  • Security Only users who can manage WooCommerce can create, edit or publish hide-price rules (Authors no longer can).
  • Fixed Rules now also apply on AJAX requests (quick view, AJAX filters, guest AJAX checkout).
  • Fixed Variable products in block-based product grids (Product Collection) show the price text instead of the price range.
  • Improved New filters hpb_rules_apply and hpb_rule_capability; new helpers HBP_Hide_Price_Frontend::hpb_get_product_rule() and hpb_is_restricted().
  • Improved Tested up to WordPress 7.1 and WooCommerce 11.2.
Version 1.0.3
  • Fixed Shop-loop "Hide Add to Cart Button" now actually hides the button — handler was registered with add_action() on woocommerce_loop_add_to_cart_link, which is a filter, so the modified markup was discarded; switched to add_filter().
  • Fixed Product/category/role/country selections now stored as typed arrays (ints/keys) so strict in_array checks actually match — previously rule scoping by product or excluded products could silently fail.
  • Fixed Rule evaluation now also checks the variation's parent product id when a variation's price is requested directly, so variations correctly inherit their parent's product/category-scoped rules.
  • Fixed Cached rule options now stored as native arrays (no manual serialize wrapper) and marked non-autoloaded to reduce options-table bloat.
  • Fixed Cached rules are refreshed on untrash and on permanent delete (previously stale caches kept hiding prices after restore/delete).
  • Fixed Save handler now skips post revisions and casts priority/IDs explicitly.
  • Fixed Replaced WC_Countries::__get('countries') with public get_countries() API.
  • Fixed Replaced direct $wp_roles global access with wp_roles() helper and translated role names via translate_user_role().
  • Fixed Rule list "Included Categories" column no longer fatals when a saved term has been deleted (WP_Term instance check).
  • Fixed Category term query now passes hide_empty=false so empty categories remain selectable in the admin UI.
  • Fixed Frontend assets now also load on singular pages where rules exist (so shortcode/block-rendered products keep popup functionality), filterable via 'hpb_enqueue_frontend_assets'.
  • Fixed Added WC_Product instance guards on price/purchaseable/loop filters to defend against third-party callers passing non-product objects.
  • Fixed Removed unused global $woocommerce inside the metabox renderer.
  • Fixed Synchronized plugin header Version, readme Stable tag, and HIDE_PRICE_VERSION constant.
Version 1.0.2
  • Fixed Added Plugin URI to plugin header.
  • Fixed WC check changed to class_exists() for reliable detection.
  • Fixed Singleton pattern applied to prevent double instantiation.
  • Fixed Plugin version constant added.
  • Fixed False WooCommerce copyright removed from plugin header.
  • Fixed Frontend assets now scoped to WooCommerce pages only.
  • Fixed maybe_unserialize() used instead of raw unserialize() for rule data.
  • Fixed Strict comparisons added to in_array() calls.
  • Fixed Removed dangerous woocommerce_product_get_regular_price filter that returned non-numeric text and could corrupt WooCommerce price calculations, sale logic, blocks, and REST API output.
  • Fixed Geolocation lookup is now lazy-loaded only when a rule actually has country restrictions, avoiding an unnecessary WC_Geolocation call on every front-end page load.
  • Fixed Country restriction is now correctly enforced when location cannot be determined (previously the rule still applied if geolocation returned no country).
  • Fixed Added isset() guards on rule keys (custom_button, button_type, popup_content, rule_id) to prevent PHP 8 undefined-array-key warnings when rendering custom buttons and popups.
  • Fixed Custom-button output now uses strict comparisons and skips rules whose custom_button flag is not enabled instead of relying on inverted-condition fall-through.
  • Fixed Popup output now only emits markup for rules using the enquiry popup button type and validates rule shape before rendering.
  • Fixed Added is_array() guard in rule processing to skip malformed/legacy rule payloads safely.
  • Fixed Removed dead hpb_add_to_cart_button_variable_product() method that was never hooked.
  • Fixed Removed redundant init action whose only job was eager geolocation.
  • Fixed Replaced loose == comparisons with === on post_type checks and rule flag checks.
  • Fixed Single-product enquiry popup trigger is now a real <button type="button"> so it does not submit the variation/add-to-cart form when clicked.
  • Fixed Shop-loop enquiry popup trigger anchor now includes href="#" for valid HTML and accessibility.
  • Fixed Removed misleading wp_kses_post() wrapper around wp_editor() (wp_editor echoes directly and returns null, so the wrapper did nothing).
  • Fixed Popup-content editor textarea_rows raised from 2 to 5 for usability.
  • Fixed Renamed wp_editor editor id to alphanumeric-only (hpbpopupcontent) for reliable TinyMCE initialization across WP versions.
Version 1.0.1
  • Fixed Added Plugin URI to plugin header.
  • Fixed WC check changed to class_exists() for reliable detection.
  • Fixed Singleton pattern applied to prevent double instantiation.
  • Fixed Plugin version constant added.
  • Fixed False WooCommerce copyright removed from plugin header.
  • Fixed Frontend assets now scoped to WooCommerce pages only.
  • Fixed maybe_unserialize() used instead of raw unserialize() for rule data.
  • Fixed readme.txt Stable tag corrected to 1.0.1.
  • Fixed WC requires at least and WC tested up to added to readme.txt.
Version 1.0.0
  • Improved Initial release.

Every release

Plugin releases and store tips, once a month

New releases, update warnings and one fix worth making.

One short email a month at most. We send a confirmation link first, and every email has a one-click unsubscribe. Privacy policy