Custom Woocommerce Product Query

Question

I work on a project that shows some travels (depending on the destination category). I try to sort the travels on the start date (var_confirmed_date) but the result is the same as no sorting.

Here is my query:

`$args = array(
                    'posts_per_page'    => -1,
                    'post_type'         => 'product',
                    'meta_value'        =>  'meta_value',
                    'meta_key'          =>  'var_confirmed_date',
                    'order'             =>  'ASC',
                    'meta_type'         =>  'DATE',
                    'tax_query'         => array(
                        array(
                            'taxonomy'  => 'destination',
                            'field'     => 'id',
                            'terms'     => array($t_id)
                        )
                    ),
                    'meta_query' => array(
                        array(
                            'key'     => 'var_confirmed_date',
                            'value'   => date("Y-m-d",time()),
                            'compare' => '>=',
                            'type'    => 'DATE',
                        ),
                    ),
                );
            $loop = new WP_Query( $args );`

Any idea to make it work correctly?

Thanks.

0
Maxime 4 months 0 Answers 21 views 0

Leave an answer