Home › Forums › WoodMart support forum › Catalog Mode
Catalog Mode
- This topic has 3 replies, 2 voices, and was last updated 7 years, 3 months ago by Artem Temos.
-
AuthorPosts
-
October 2, 2017 at 2:42 pm #20582
jinsley8ParticipantHi,
I’m using this plugin to hide the price and Add to Cart buttons from users who are not logged in.
https://woocommerce.com/products/catalog-visibility-options/
However, it doesn’t work on your quickview. When not logged in, you can press the product quickview to see price and button still.
Is there a function I can use to only show these conditionally to users logged in only?
October 2, 2017 at 2:48 pm #20585
Artem TemosKeymasterHello,
It seems to be a problem in the plugin since it doesn’t work with AJAX loaded content. Our quick view uses the same WooCommerce functions as on the single product page. If you want to modify it check the file
basel/woocommerce/content-quick-view.php
.Regards
October 2, 2017 at 8:45 pm #20601
jinsley8ParticipantOkay I fixed it with my own functions – for anyone looking to do the same:
add_action('after_setup_theme','custom_activate_filter') ; function custom_activate_filter() { add_filter('woocommerce_get_price_html', 'custom_show_price_logged'); } function custom_show_price_logged($price) { if(is_user_logged_in() ) { return $price; } else { // Remove Price from Single Product Page remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); // Remove Price from Shop/Category Pages remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); // Remove Add to Cart from Shop/Category Pages (Limitation: This code will remove "Select Option" from Grouped and Variable product also remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); // Remove Add to cart from Single Product Page remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 ); remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 ); remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 ); remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 ); remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 ); return '<a href="/login">Login for pricing</a>'; } }
October 3, 2017 at 6:14 am #20622
Artem TemosKeymasterHi,
Thank you very much for posting your solution here.
Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register