This topic has 4 replies, 2 voices, and was last updated 10 years, 2 months ago ago by Eva Kemp
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.
Hello,
Do you want to hide “Add to cart” button only for non-logged in users or for all users? If you want it for all users you can enable “Just Catalogue” in Theme Options.
If you need it only for non-logged in users it requires additional customization and is a paid service. If you agree you can create a ticket at http://support.8theme.com/ and our specialists will look into your issue.
Regards,
Eva Kemp.
No, I just wanted to know how to disable “add to cart” button and price from:
– shop
– single product page
– quick view
When a user logs in, instead, he must see prices and “add to cart” button too. Is that a paid help? 😛 Couldn’t you put in your next theme update, instead?
Hello,
Yes, it requires additional customization in the theme files and isn’t for free.
We’ve taken this into our account and will try to implement this feature in our future updates.
Thank you.
Regards,
Eva Kemp.
The issue related to '‘Remove prices and cart for not logged in users’' has been successfully resolved, and the topic is now closed for further responses