I am using this code for hiding short description to logged out users but it does not work – it shows the message asking user to login but it still shows the short description.
add_filter( 'woocommerce_short_description', 'add_text_before_short_description_for_guests' );
function add_text_before_short_description_for_guests( $description ) {
// Only for guest users
if ( ! is_user_logged_in() ) {
$description = '<p>' . sprintf( __( "To check if this item qualifies for a discount %s an account."), '<a href="my-account link goes here"><u><strong>' . __("Log In or Create") . '</strong></u></a>' ) . '</p>' . $description;
}
return $description;
}
Thank you