Skip to content

Instantly share code, notes, and snippets.

@chrdesigner
Last active August 25, 2015 23:35
Show Gist options
  • Save chrdesigner/bb9371f608ee20428631 to your computer and use it in GitHub Desktop.
Save chrdesigner/bb9371f608ee20428631 to your computer and use it in GitHub Desktop.
Function - Show the price only after logging
<?php
/*
* Function - Show the price only after logging
*/
add_filter('woocommerce_get_price_html','show_price_logged');
function show_price_logged($price){
if( is_user_logged_in() ){
return $price;
} else {
return '<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '" title="Já tenho Conta" class="btn-myaccount">Já tenho Conta</a> ou <a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '" title="Registrar para visualizar o preço!" class="btn-registrar">Registrar para visualizar o preço!</a>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment