admin管理员组文章数量:1279048
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 );
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 );
Share
Improve this question
edited Nov 8, 2021 at 8:33
Stéphane Dumas
asked Nov 5, 2021 at 8:41
Stéphane DumasStéphane Dumas
12 bronze badges
1 Answer
Reset to default 1You are missing a closing tag for the opening link (<a>
) tag, try:
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 );
(You could also just spit out the login form right there instead of linking off, if you wanted):
function filter_woocommerce_checkout_must_be_logged_in_message( $message ) {
$login_form = wp_login_form( [ 'echo' => false ] );
$message = '<p>You must be logged in:</p>';
$message .= $login_form;
return $message;
}
add_filter( 'woocommerce_checkout_must_be_logged_in_message', 'filter_woocommerce_checkout_must_be_logged_in_message', 10, 1 );
本文标签: woocommerce offtopicAdd html link in functionsphp files of the theme
版权声明:本文标题:woocommerce offtopic - Add html link in functions.php files of the theme 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741230691a2362052.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论