Skip to content

Instantly share code, notes, and snippets.

@jameshwartlopez
Created July 23, 2017 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jameshwartlopez/8cb20bde72e6217121f4b6569688b9be to your computer and use it in GitHub Desktop.
Save jameshwartlopez/8cb20bde72e6217121f4b6569688b9be to your computer and use it in GitHub Desktop.
Hide Woocommerce price for not logged in users
function hide_price_if_not_logged_in( $price ) {
$isLoggedIn = is_user_logged_in();
if(false == $isLoggedIn){
//return empty html price
return '';
}
return $price;
}
add_filter( 'woocommerce_get_price_html', 'hide_price_if_not_logged_in' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment