Created
April 7, 2015 04:47
-
-
Save ibndawood/3835c94a5113fe6362a8 to your computer and use it in GitHub Desktop.
Show price only to Registered Users
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_get_price_html', 'show_price_only_to_registered_users', PHP_INT_MAX ); | |
function show_price_only_to_registered_users( $price ) { | |
if( ! is_user_logged_in() ){ | |
return __( 'Please register to view prices', 'theme_name' ); | |
} else { | |
return $price; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment