2

I have a custom order history screen which is returning over 3,000 results with my query. I'm actually only looking to return 5 objects in this query. Is it possible to specify specific columns to be returned?

I've read here the article below which talks specifically about WC_Product_Query but not wc_get_orders which I use.

My query;

$orders = wc_get_orders( array(
    'limit'             => -1,
    'status'            => 'completed',
    'date_completed'    => $end_date.'...'.$start_date,
    'meta_query' => array(
        array(
            'key' => 'order_rate',
            'compare' => '!=',
            'value' => NULL
        )                   
    ),
    'meta_key'          => '_date_completed',
    'orderby'           => 'meta_value_num',
    'order'             => 'DESC',
));

Can I specify data to be returned instead of everything attached to an order, mainly custom meta data set via ACF? e.g. order_rate

mujuonly
  • 11,370
  • 5
  • 45
  • 75
archvist
  • 712
  • 2
  • 18
  • 41

0 Answers0