Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Add Customer to Coupon On The Fly › Reply To: Add Customer to Coupon On The Fly
March 20, 2020 at 7:30 pm
#15174
Heidi Maskelyne
Participant
I have sorted and fixed
$coupon_id= wc_get_coupon_id_by_code('example');
$add_coupon_id = array_merge(explode(',', get_post_meta($coupon_id, '_wjecf_customer_ids', true)), array($user_id));
update_post_meta($coupon_id, '_wjecf_customer_ids',implode(',', $add_coupon_id));
Thanks