Created
July 23, 2017 16:02
-
-
Save jameshwartlopez/8cb20bde72e6217121f4b6569688b9be to your computer and use it in GitHub Desktop.
Hide Woocommerce price for not logged in 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
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