Display custom message to customers coming from referral link

READ FIRST: This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven't done this before, adding this code in wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help!

If you want to write some text on the checkout screen, to the users coming through referral link, add code below to the functions.php file:

add_action('woocommerce_before_checkout_form', 'my_custom_message');
function my_custom_message() {
if ( isset($_COOKIE['gens_raf']) ) {
       wc_print_notice( __('This is my custom message'), 'notice' );
    }
}

Depending on your theme, a customer should see something like:

Still need help? Contact Us Contact Us