Home › Forums › Basel support forum › Pricing Shows When Logged Out Users Adds Item to Cart
Pricing Shows When Logged Out Users Adds Item to Cart
- This topic has 6 replies, 2 voices, and was last updated 7 years, 11 months ago by Artem Temos.
-
AuthorPosts
-
December 2, 2016 at 6:44 pm #7505
robertarrowParticipantI know we’ve worked on this before, but the client has just notified me that a logged-out user, can still add a product to the cart and see the pricing for that product in the cart. Is there anything we can do to fix that?
// Hide prices add_action('after_setup_theme','activate_filter') ; function activate_filter(){ add_filter('woocommerce_get_price_html', 'show_price_logged'); } function show_price_logged($price){ if(is_user_logged_in() ){ return $price; } else { remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); return '<a href="' . get_permalink(woocommerce_get_page_id('myaccount')) . '">Login to See Prices</a>'; } } add_filter('body_class','nec_logged_in_filter'); function nec_logged_in_filter($classes) { if( is_user_logged_in() ) { $classes[] = 'logged-in'; } else { $classes[] = 'logged-out'; } // return the $classes array return $classes; }
December 2, 2016 at 6:46 pm #7506
robertarrowParticipantIs there any way to use one of these alternatives? I’m sorry I have no PHP experience and our Web Developer is no longer with us.
https://businessbloomer.com/woocommerce-hide-price-add-cart-logged-users/
December 2, 2016 at 6:57 pm #7509
Artem TemosKeymasterHello,
But how your users are able to add products to cart if there are no add to cart button visible on your shop pages?
Regards
December 2, 2016 at 7:01 pm #7510
robertarrowParticipantOnly users that have been approved, should be able to purchase anything on this particular site. If you do not have an account, you should only be able to see the site as a catalog, with all of the variations of the products and what not, but not as a “shop” if that makes sense.
December 2, 2016 at 8:36 pm #7511
Artem TemosKeymasterYes, we understand. But we just visited your website and see that it works in exactly this way. There are no add to cart buttons on your website when I’m not logged in.
Regards
December 2, 2016 at 8:41 pm #7515
robertarrowParticipanthttps://www.aquahairextensions.com/product-category/clip-in-hair-extensions/
https://postimg.org/gallery/26fmk537w/
Where it says ‘Login to See Prices’ if you hover over it, it changes to ‘Add to Cart,’ which it then does and then you can see ‘View Cart’
December 2, 2016 at 11:00 pm #7518
Artem TemosKeymasterOk, try to hide it with Custom CSS also
.logged-out .btn-add { display:none; }
Regards
-
AuthorPosts
Tagged: pricing
- You must be logged in to create new topics. Login / Register