title: How to get user orders by date in woocommerce?
body: <p>I'm looking for a standard way of getting a user total sum of orders in a date range or for current month.</p>
  
  <p>After exploring woocommerce source code, what I got is, woo is using something like this</p>
  
  <pre><code>            $order_item_amounts = $this-&gt;get_order_report_data( array(
              'data' =&gt; array(
                  '_line_total' =&gt; array(
                      'type'            =&gt; 'order_item_meta',
                      'order_item_type' =&gt; 'line_item',
                      'function' =&gt; 'SUM',
                      'name'     =&gt; 'order_item_amount'
                  ),
                  'post_date' =&gt; array(
                      'type'     =&gt; 'post_data',
                      'function' =&gt; '',
                      'name'     =&gt; 'post_date'
                  ),
                  '_product_id' =&gt; array(
                      'type'            =&gt; 'order_item_meta',
                      'order_item_type' =&gt; 'line_item',
                      'function'        =&gt; '',
                      'name'            =&gt; 'product_id'
                  ),
              ),
              'where_meta' =&gt; array(
                  'relation' =&gt; 'OR',
                  array(
                      'type'       =&gt; 'order_item_meta',
                      'meta_key'   =&gt; array( '_product_id', '_variation_id' ),
                      'meta_value' =&gt; $this-&gt;product_ids,
                      'operator'   =&gt; 'IN'
                  ),
              ),
              'group_by'     =&gt; 'product_id, ' . $this-&gt;group_by_query,
              'order_by'     =&gt; 'post_date ASC',
              'query_type'   =&gt; 'get_results',
              'filter_range' =&gt; true
          ) );
  </code></pre>
  
  <p>in class-wc-report-sales-by-product.php</p>
  
  <p>But as you know, this works based on products not users.
  from the above code,
   <code>$this-&gt;group_by_query</code> part holds the conditions for dates which can be found in woo source. My question is actually about how to use a builtin function of woocommerce to generate a list of orders based on given date range.</p>
  
  <p>Thanks</p>