Child order status generated by the WC marketplace does not update in the seller

General Marketplace Discussion (User’s interaction forum)

Child order status generated by the WC marketplace does not update in the seller Open

Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #96324
      hinckleydantas
      Participant

      First I want to thank the WCMARKETPLACE team for creating a plugin like this, wonderful! I’m already using it, and very satisfied, I even made my first sale! With the plugin working I noticed a discrepancy in the status of the generated request, as I haven’t found a topic that can clarify my doubt, I’m opening this …

      The customer purchased a product from a seller and an order number # 2035 was generated in my store. Using the WIRECARD gateway, payment was approved immediately and the order changed status from Waiting to Processing.
      I understand that the WCMARKETPLACE system generated a child order for the seller with the number # 2036. The problem is that on the seller’s panel, order # 2036 has not changed status, and remains “Awaiting payment”.

      I performed some tests, waited more than 24 hours and nothing to update … I came to the conclusion that for some reason the status of the “child order” does not update either for canceled or for processing (approved) …

      I suppose there must be a problem, because the way it is there is no way for the seller to know if the order was approved …
      How can I fix this?

      I thank you for your attention.

    • #96375

      @hinckleydantas, great to know that WC Marketplace is able to help you out.

      Let me help you out with the current order status flow :
      – When an order is created on the woocommerce end, we create the corresponding sub-order.
      – Now, we check the initial order status of the order from woocommerce’s main order and set same order status for suborders too
      – After that, each vendor/admin needs to change order status for each sub-order
      – Therefore, apart from initial order status, if you change status of an order, this will not affect the sub order’s status
      Now, you need to add some custom code to sync the parent order status with the sub orders:

      //auto sync completed orders//
      add_action( 'woocommerce_order_status_completed', 'wcmp_order_status_completed' );
      function wcmp_order_status_completed( $order_id ) {
        global $WCMp;
        $suborder_details = $WCMp->order->get_suborders($order_id);
        foreach ($suborder_details as $key => $value) {
            $suborder_fetch = array(
                'ID'           => $value->get_id(),
                'post_status'   => 'wc-completed',
            );
            wp_update_post( $suborder_fetch );
        }
      }
      Copy
      //auto sync processing orders
      add_action( 'woocommerce_order_status_processing', 'wcmp_suborder_status_change_to_processing' );
      function wcmp_suborder_status_change_to_processing( $order_id ) {
        global $WCMp;
        $suborder_details = $WCMp->order->get_suborders($order_id);
        foreach ($suborder_details as $key => $value) {
            $suborder_fetch = array(
                'ID'           => $value->get_id(),
                'post_status'   => 'wc-processing',
            );
            wp_update_post( $suborder_fetch );
        }
      }
      Copy

      Also, I hope you are satisfied with our assistance and plugin. A 5/5 review here- https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post , would be a great way to share your experience with others.

    • #96415
      hinckleydantas
      Participant

      Hello, how are you? I already want to thank you for the quick response, I also did a 5/5 review, because the plugin is wonderful and the support too!

      Thanks for sharing the code, it will help me a lot!
      But, where exactly should I insert this code?

      I thank you once again for your attention.

    • #96537

      @hinckleydantas, you just need to add this code in the function.php of your current active theme. So, access ftp and goto the theme folder. there access the current theme folder file.
      It is always better to create a child theme and use that theme. Thi way you can update the theme without losing any changes.

Viewing 3 reply threads

Please LOGIN to reply to this topic

COVID-19 Outbreak: WCMp team is supporting business affected by coronavirus

Read the Message Buy at Slashed Price