Site icon Hip-Hop Website Design and Development

Add html link in php

I use the option that people need to have an account to checkout. So the checkout page is blocked. At that moment you’ll get the message “You must be logged in to checkout”.

To improve that customers don’t have to search where to click next, i want to add extra text with an hyperlink.

I found this code work perfectly but HTML is not working inside ‘MY MESSAGE’ area.

function filter_woocommerce_checkout_must_be_logged_in_message( $message ) {
    $message = 'MY MESSAGE';
    return $message; 
}
add_filter( 'woocommerce_checkout_must_be_logged_in_message', 'filter_woocommerce_checkout_must_be_logged_in_message', 10, 1 );

So far i got this but html is not working on my end.

function filter_woocommerce_checkout_must_be_logged_in_message( $message ) {
    $message = '<span>You must be <a href="#"logged in</a></span>';
    return $message; 
}
add_filter( 'woocommerce_checkout_must_be_logged_in_message', 'filter_woocommerce_checkout_must_be_logged_in_message', 10, 1 );