Display a custom message for guest users in Woocommerce checkout page

不羁的心 提交于 2019-12-01 13:45:56

To display a custom notice in checkout page for non logged users:

add_action('woocommerce_before_checkout_form', 'my_custom_message');
function my_custom_message() {
    if ( ! is_user_logged_in() ) {
        wc_print_notice( __('This is my custom message'), 'notice' );
    }
}

Code goes in function.php file of your active child theme (or active theme). Tested and works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!