/** * Hide prices and "add to cart" action for guests. * Need help customising the code for your need? Hire us on Codeable: https://aelia.co/hire_us * * @author Aelia * @link https://aelia.co */ function aelia_hide_prices_for_guests() { if(!is_user_logged_in()) { // If user is not logged in, hide the prices on the catalogue and product pages remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10); remove_action('woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 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); } } add_action('init', 'aelia_hide_prices_for_guests');