Check coupon condition against woocommerce coupon

Verify conditions associated with a WooCommerce coupon.

add_filter('advanced_woo_discount_rules_select_coupon_from_woocommerce', function($result, $operator, $applied_coupons, $selected_coupon_list, $cart, $options){
            if($operator == "at_least_one"){
                $args = array(
                    'posts_per_page'   => -1,
                    'orderby'          => 'title',
                    'order'            => 'asc',
                    'post_type'        => 'shop_coupon',
                    'post_status'      => 'publish',
                );

                $coupons = get_posts( $args );

                $coupon_names = array();

                foreach ( $coupons as $coupon ) {
                    // Get the name for each coupon post
                    $coupon_name = $coupon->post_title;
                    array_push( $coupon_names, $coupon_name );
                }
                if(!empty($coupon_name) && !empty($applied_coupons)){
                    $result = !empty(array_intersect($applied_coupons, $coupon_names));
                }
            }
            return $result;
        },10, 6);