Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Remove Customer Programically From Allowed List › Reply To: Remove Customer Programically From Allowed List
January 8, 2020 at 4:32 pm
#13019
Soft79
Keymaster
Careful with that. if user id is for example 111, then also 1110 will be replaced. Example:
<?php
$current_user = '111';
$meta = '110,111,112,1110,1120';
//Wrong
$allowed_customer_ids = explode(',', str_replace($current_user,'',$meta));
print_r($allowed_customer_ids);
//Better
$allowed_customer_ids = array_diff(explode(',', $meta), array($current_user));
print_r($allowed_customer_ids);