Add a referrer to Woocommerce Orders & Show In Back End

Viewed 13

I'm using this code from another thread:

Add Referrer info to WooCommerce order

Code as follows:

add_action( 'woocommerce_new_order', 'add_referral_meta', 10, 1);
function add_referral_meta( $order_id ){
    $ref_url = $_COOKIE['origin']; // Get the cookie
    update_post_meta( $order_id, 'referrer', $ref_url ); // Add to order meta
}

However I am not seeing any referral code in the Woocommerce Orders created in the backend.

Is there a way to show where the referrer came from within the Woocommerce order?

0 Answers
Related