-
-
Save dublado/1ef6ff24cdeb740961da79e5f9c0e11b to your computer and use it in GitHub Desktop.
WooCommerce - Display price only for logged in users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cs_prices_only_for_logged_in_users() { | |
if ( ! is_user_logged_in() && ! is_admin() ) { | |
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ); | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); | |
} | |
} | |
add_action( 'init', 'cs_prices_only_for_logged_in_users' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment