Undefined index: ref
-
v2.2
PHP Notice: Undefined index: ref in /path/to/wp-content/plugins/goaffpro/goaffpro.php on line 95
In:
/** * Add goaffpro referral cookie in woocommerce order metadata if referral cookie is available. * This helps in tagging the orders received with the unique ID of the affiliate who sent the customer */ add_action('woocommerce_checkout_update_order_meta',function( $order_id, $posted ) { $referral_code = sanitize_text_field($_COOKIE['ref']); if($referral_code){ update_post_meta($order_id, 'ref', $referral_code); } } , 10, 2);
Fix with:
add_action('woocommerce_checkout_update_order_meta',function( $order_id, $posted ) { if( ! isset( $_COOKIE['ref'] ) ) { return; } $referral_code = sanitize_text_field($_COOKIE['ref']); if($referral_code){ update_post_meta($order_id, 'ref', $referral_code); } } , 10, 2);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Undefined index: ref’ is closed to new replies.