I am creating a custom coupon and trying to exclude products to use that specific coupon but when i am adding products id in that code its only adding 1 product in the exclude not others.
$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$bemail= 'email@gmail.com';
$coupon = new WC_Coupon();
$coupon->set_code( substr(str_shuffle($permitted_chars), 0, 16) . '5489' );
$coupon->set_amount(5489);
$coupon->set_excluded_product_ids(1393,1324);
$coupon->set_email_restrictions($bemail);
$coupon->save();