Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active October 9, 2018 14:30
Show Gist options
  • Save plugin-republic/10b70cfa44309744c232777747bbd0ee to your computer and use it in GitHub Desktop.
Save plugin-republic/10b70cfa44309744c232777747bbd0ee to your computer and use it in GitHub Desktop.
Use WC_Order_Query to query WooCommerce orders
<?php
$args = array(
'limit' => 9999,
'return' => 'ids',
'date_completed' => '2018-10-01...2018-10-10',
'status' => 'completed'
);
$query = new WC_Order_Query( $args );
$orders = $query->get_orders();
foreach( $orders as $order_id ) {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment