Skip to content

Instantly share code, notes, and snippets.

@sunnyluthra
Created October 5, 2014 07:58
Show Gist options
  • Save sunnyluthra/53d2cba72f200a2c8a39 to your computer and use it in GitHub Desktop.
Save sunnyluthra/53d2cba72f200a2c8a39 to your computer and use it in GitHub Desktop.
woocommerce-hide-price-logged-out.php
add_action('after_setup_theme', 'show_price_logged');
function show_price_logged($price) {
if (!is_user_logged_in()) {
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment