This simple Woocommerce WordPress script can be modified for a variety of purposes, such adding in Country specific currency symbols like AUD, USD, or appending additional information. The example below shows login or register links until they are logged in, and when logged in will see the normal price as listed.add_filter(‘woocommerce_get_price_html’,’members_only_pricing’);

function members_only_pricing($price){
if(is_user_logged_in() ) {
 return $price;
else {
 remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
 remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
 remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
 remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
 return '<a href="'.site_url('/wp-login.php?action=register&redirect_to=' . get_permalink()).'">Login</a> to view our prices.'; 

Place in your themes functions.php – Let me know how it goes.

One comment on “Woocommerce Hide Price until User Logged in”

  • Danny Russell (author)

    How would you do this to hide pricing etc on variable products?

Leave a Reply

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