1. Home
  2. Knowledge Base
  3. WooCommerce Wholesale Pro
  4. Advanced Usage

Code snippet: Change the text of the 'Hide Price Until Login' Read More button

When the 'Hide Prices Until Login' feature in WooCommerce Wholesale Pro is enabled, then logged out users will see the following:

  • The main Shop page, category pages etc. will show the product with no prices, and the add to cart buttons will change to 'Read More' buttons.
  • The single product pages will show the Alternate content that you entered in the plugin settings.

The following code snippet allows you to change the text of the 'Read More' buttons. In our example, we changed it to "PLEASE LOGIN" so you can change this to anything you like:

function change_read_more_text() {
if ( !is_user_logged_in() ) {
return __('PLEASE LOGIN', 'woocommerce');
}
return get_option( 'woocommerce_product_add_to_cart_text' );
}
add_filter( 'woocommerce_product_add_to_cart_text', 'change_read_more_text' );

If you're unsure how to use the code snippet then please see our article about Adding code snippets to your site.

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.