I use the following below code for show custom message to un-logged woocommerce users (visitors) in checkout page
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' );
}
}
top code recive this forum, from mr @loictheaztec
my before question link below:
Display a custom message for guest users in Woocommerce checkout page
I would like to change woocommerce_before_checkout_form in code for move my message to top (first) in checkout page. But I have no idea how to do it. I only know those two hooks below (related to checkout page):
woocommerce_before_checkout_form
woocommerce_after_checkout_form
To display Your custom message in checkout page before the Woocommerce login message and before add coupon message, you will use the following code instead:
Code goes in function.php file of your active child theme (or active theme). Tested and works.
A more simpler version for all users in checkout page only:
Code goes in function.php file of your active child theme (or active theme). Tested and works.