diff --git a/includes/api/class-wc-api-coupons.php b/includes/api/class-wc-api-coupons.php index 1cfd1dab0e8..a026e07fc8e 100644 --- a/includes/api/class-wc-api-coupons.php +++ b/includes/api/class-wc-api-coupons.php @@ -342,11 +342,11 @@ class WC_API_Coupons extends WC_API_Resource { } if ( isset( $data['product_ids'] ) ) { - update_post_meta( $id, 'product_ids', array_filter( array_map( 'intval', $data['product_ids'] ) ) ); + update_post_meta( $id, 'product_ids', implode( ',', array_filter( array_map( 'intval', $data['product_ids'] ) ) ) ); } if ( isset( $data['exclude_product_ids'] ) ) { - update_post_meta( $id, 'exclude_product_ids', array_filter( array_map( 'intval', $data['exclude_product_ids'] ) ) ); + update_post_meta( $id, 'exclude_product_ids', implode( ',', array_filter( array_map( 'intval', $data['exclude_product_ids'] ) ) ) ); } if ( isset( $data['usage_limit'] ) ) {