Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

how to get the details of suborders status “Processing”

MultivendorX

Resolved
Viewing 6 reply threads
  • Author
    Posts
    • #192315
      l.gan
      Participant

      Hello team.
      Thanks for the great plugin support.

      Please tell me how to get the details of suborders that are now with the status “Processing” and “on hold”:

      Suborder number
      (Product photo),
      Product Name,
      Delivery method

      I need the client to see the suborders that he will receive in his personal account. If there are several suborders, then they would be displayed as separate elements.

      Could you help me with this, thanks.
      See photo

      add_action( ‘woocommerce_account_content’, ‘сс_account_user_suborder_in_process’, 0);
      function сс_account_user_suborder_in_process() {
      ??
      }

    • #192351

      Hi,
      First of all let me know where you want to add the details in frontend and also do you want to show this in the customer account. Let me know then we will help you out accordingly.

      Regards,

    • #192355
      l.gan
      Participant

      Hello

      Thanks for your reply and help
      Yes, I would like to show this in the client’s personal account when he is logged in. Please see photo.

    • #192367

      Hi,
      Kindly add below code to your function.php of the active current theme.

      add_action( 'woocommerce_after_my_account', 'mvx_woocommerce_account_content_action' );
      
      function mvx_woocommerce_account_content_action(){
           $customer = wp_get_current_user();
          // Get all customer orders
          $customer_orders = get_posts(array(
              'numberposts' => -1,
              'meta_key' => '_customer_user',
              'orderby' => 'date',
              'order' => 'DESC',
              'meta_value' => get_current_user_id(),
              'post_type' => wc_get_order_types(),
              'post_status' => array('wc-processing', 'wc-onhold'),
              'fields'  => 'ids',
          ));
          if ($customer_orders) {
              foreach ($customer_orders as $customer_order) {
                  $mvx_suborders = get_posts( array( 
                      'post_parent' => $customer_order,
                      'posts_per_page' => -1,
                      'post_status' => array('wc-processing', 'wc-onhold'),
                      'post_type' => wc_get_order_types(),
                      'fields'  => 'ids',
                  ));
                  if ($mvx_suborders) {
                      foreach ($mvx_suborders as $mvx_suborder) {
                          $order = wc_get_order($mvx_suborder);
                          $order_id = $order->id;
                          $shipping_method = $order->get_shipping_method();
      
                          // data to show
                          echo $order_id . '<br>';
                          // // Get and Loop Over Order Items
                          foreach ( $order->get_items() as $item_id => $item ) {
                              $product_name = $item->get_name();
                              echo $product_name . '<br>';
                              $image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $item->get_product_id() ), 'single-post-thumbnail' );
                              
                              echo '<img src="'. $image_url[0] .'" width="40" height="40"/>';
                          }
                          
                          echo $shipping_method .'<br>';
                      }  
                  }
              }
          }
      }
      Copy

      checkout the image – https://prnt.sc/Pimt6sZokSTy
      ** design as per your requirement.

      Regards,

      • #192376
        l.gan
        Participant

        Super-Thankyou, it worked!

    • #192390

      Hi @l.gan We are happy to help you .
      Also , it would be really great if you can give us 5/5 review here: https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post
      This would motivate the team further to do their job more efficiently.

    • #192413
      l.gan
      Participant
      This reply has been marked as private.
    • #192418

      @l.gan, thank you.

Viewing 6 reply threads

The topic ‘how to get the details of suborders status “Processing”’ is closed to new replies.