• Hey, I have a custom page in my admin area and need to query any orders that are pre-orders.

    $customer_orders = wc_get_orders([
    ‘status’ => ‘processing’, // Only fetch orders with the “processing” status.
    ‘orderby’ => ‘date’, // Orders will be ordered by the date (most recent first).
    ‘limit’ => 10, // Limit the number of orders fetched to 500.
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘_order_has_preorder’,
    ‘value’ => ‘yes’,
    ‘compare’ => ‘=’,
    ),
    ),
    ]);

    Am i right in thinking _order_has_preorder is part of the order meta?

    Any advice appreciated.

Viewing 1 replies (of 1 total)
  • Plugin Support Carlos M

    (@cjmora)

    Hi @jonnyjaniero,
    Yes, ‘_order_has_preorder’ with the value ‘yes’ is the indicated one to retrieve orders that include pre-order among its order items.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.