Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @snippet Hide Price & Add to Cart for Logged Out Users
- * @how-to Watch tutorial @ https://businessbloomer.com/?p=19055
- * @sourcecode https://businessbloomer.com/?p=299
- * @author Rodolfo Melogli
- * @testedwith WooCommerce 3.3.4
- */
- add_action( 'init', 'bbloomer_hide_price_add_cart_not_logged_in' );
- function bbloomer_hide_price_add_cart_not_logged_in() {
- if ( !is_user_logged_in() ) {
- 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 );
- remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
- remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement