Skip to content

Instantly share code, notes, and snippets.

@michelmany
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save michelmany/a5c78fc73a566d84f035 to your computer and use it in GitHub Desktop.

Select an option

Save michelmany/a5c78fc73a566d84f035 to your computer and use it in GitHub Desktop.
REMOVE PREÇOS E BOTÃO DE ADICIONAR NO CARRINHO PARA USUÁRIOS NÃO LOGADOS
function cs_prices_only_for_logged_in_users() {
if ( ! is_user_logged_in() ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
}
add_action( 'init', 'cs_prices_only_for_logged_in_users' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment