• Resolved maurosp91

    (@maurosp91)


    Hi,

    How do I get all orders from a selected vendor?

    I tried this but it doesn’t work:

    $args = array(
        'post_type' => 'shop_order',
        'meta_key'    => '_dokan_vendor_id',
        'meta_value'  => $seller_id,
       'posts_per_page' => '-1'
      );
      $my_query = new WP_Query($args);
      
      $user_orders = $my_query->posts;

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @maurosp91,

    According to our support policy, we are unable to review a custom code. If you want to get all the orders of a vendor then you can use the dokan_get_seller_orders this function. To see the code example of the function you can have a look at wp-content/plugins/dokan-lite/includes/Order/functions.php this file.

    I hope this will help. Thanks!

    Thread Starter maurosp91

    (@maurosp91)

    I got with the solution:

    $query = new WC_Order_Query( array(
        'limit' => 300,
        'post_type'   => 'shop_order',
        'meta_key'    => '_dokan_vendor_id',
        'meta_value'  => $seller_id,
        'post_status' => array_keys( wc_get_order_statuses() ),
        'status' => array('wc-processing', 'wc-on-hold', 'wc-pending'),
        'return' => 'ids',
    ) );
    $user_orders = $query->get_orders();

    I get all the order ids from a seller, and with certain order status.

    Hope it helps someone else!

    Plugin Support Jahidul Hassan Mojumder

    (@jahidulhassan)

    Hi @maurosp91,

    Great to know that it worked for you. We are marking this topic as closed as the purpose of this topic has been served. Feel free to open a new one if you face any further issues or need further assistance with anything.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get all orders from a vendor’ is closed to new replies.