Good afternoon 8Theme,
Probably my issue has been already solved but I didn’t find anything on forums. As far as I know, to remove prices and “add to cart” actions for not logged in users I add the following code to the functions.php:
add_filter(‘woocommerce_get_price_html’,’members_only_price’);
function members_only_price($price){
if(is_user_logged_in() ){
return $price;
}
else {
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ );
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );
remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );
remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 );
return ‘Only Registered Users are able to view pricing.’;
}
}
In your theme, I tried to do the same by adding the code above in the init.php file but it doesn’t work for single product and quick view page. What’s missing? May you kindly help me to solve this issue, please?
NOTE: Since in Theme Options there’s the “Just Catalog” options, would you mind to add it even for not logged in users? It’s a common request nowadays.
Thanks a lot in advance and best regards.