title: How to get all orders of current user in woocommerce
body: <p>I want to get all orders made by current user inside a plugin function.</p>
  
  <p>I'm using this:</p>
  
  <pre><code>    function get_all_orders(){
          $customer_orders = get_posts( apply_filters( 'woocommerce_my_account_my_orders_query', array(
              'numberposts' =&gt; $order_count,
              'meta_key'    =&gt; '_customer_user',
              'meta_value'  =&gt; get_current_user_id(),
              'post_type'   =&gt; wc_get_order_types( 'view-orders' ),
              'post_status' =&gt; array_keys( wc_get_order_statuses() )
          ) ) );
     return $customer_orders;
    }
  </code></pre>
  
  <p>This works well inside theme but inside custom plugin it doesn't return anything.
  Am i doing something wrong? Should i call some WooCommerce class first?</p>