sync suborder status with parent order status

MultivendorX Pro

Resolved
Viewing 13 reply threads
  • Author
    Posts
    • #187662
      kevajo
      Participant

      Need filter for multivendor x.
      We want that when the admin changes the status of the main order, it automatically changes the status of the sub-orders.
      That is to say, if we change the status of the main order to “in progress”, the sub-orders linked to the order will also be “in progress”.

    • #187686

      Hello , in MultiVendorX the main orders get split into sub orders .Now if the admin changes the status of the suborders, the status of the main orders gets changed automatically .

      However you can use this code to sync the order status https://multivendorx.com/docs/code-snippet/parent-order-and-sub-order-status-sync/

    • #187700
      kevajo
      Participant

      Good morning
      Thank you for your reply.
      What I wanted is that whatever the status of the order in which the main order the sub-orders are in the same status.
      I have multiple custom order statuses.
      I just want it to happen automatically.
      As soon as I change the status of the main order, the sub-orders take on the same status.
      In your answer the statutes are fixed.

      Here is my code which I tried to do but it does not work.
      Please verify.
      I remember that I am on Multivendor X pro.

      // sync suborder status with parent order status
      add_action(‘woocommerce_order_status_changed’, ‘mx_parent_order_to_vendor_order_status_synchronization_clint’, 10, 3);
      function mx_parent_order_to_vendor_order_status_synchronization_clint( $order_id, $old_status, $new_status ){
      $mx_suborders = get_mx_suborders($order_id);
      if ($mx_suborders) {
      foreach ($mx_suborders as $suborder) {
      $suborder->update_status($new_status, _x(‘Update via parent order: ‘, ‘Order note’, ‘multivendorx’));
      }
      }
      }

    • #187713
    • #187715
      kevajo
      Participant

      I need a code that synchronizes any status of main command and sub commands

    • #187753

      Please add the above code we have shared in your function.php of your site. Then do some tests.
      It should work perfectly fine.

    • #188301
      kevajo
      Participant

      I fully understand what you are saying.
      The code only works for the 3 statuses “wc-completed”, “wc-cancelled” and “wc-processing”.
      But woocommerce is not limited to its 3 statuses, and also we have custom statuses.
      That’s why I want a code that encompasses any status.

      THANKS

    • #188686
      kevajo
      Participant

      I used this code and it works.
      Please update the code on mx

      // sync suborder status with parent order status
      add_action(‘woocommerce_order_status_changed’, ‘wcmp_parent_order_to_vendor_order_status_synchronization_clint’, 99, 3);
      function wcmp_parent_order_to_vendor_order_status_synchronization_clint( $order_id, $old_status, $new_status ){
      $wcmp_suborders = get_wcmp_suborders($order_id);
      if ($wcmp_suborders) {
      foreach ($wcmp_suborders as $suborder) {
      $suborder->update_status($new_status, _x(‘Update via parent order: ‘, ‘Order note’, ‘dc-woocommerce-multi-vendor’));
      }
      }
      }

    • #188928

      Use this code for MVX :

      // sync suborder status with parent order status
      add_action(‘woocommerce_order_status_changed’, ‘mvx_parent_order_to_vendor_order_status_synchronization_clint’, 99, 3);
      function mvx_parent_order_to_vendor_order_status_synchronization_clint( $order_id, $old_status, $new_status ){
      $mvx_suborders = get_mvx_suborders($order_id);
      if ($mvx_suborders) {
      foreach ($mvx_suborders as $suborder) {
      $suborder->update_status($new_status, _x(‘Update via parent order: ‘, ‘Order note’, ‘dc-woocommerce-multi-vendor’));
      }
      }
      }
      Copy
    • #190396
      Chris
      Participant

      Hi @sangita,

      Hello , in MultiVendorX the main orders get split into sub orders .Now if the admin changes the status of the suborders, the status of the main orders gets changed automatically .

      However you can use this code to sync the order status https://multivendorx.com/docs/code-snippet/parent-order-and-sub-order-status-sync/

      >> If admin allows vendor to change the status of the suborders, and when a vendor changes the status of the suborders, does the status of the main orders gets changed automatically too?

    • #190427

      Hello @Chris , the above code will only work if the admin changes order status, then the same status will be applied for all suborders of that main order.
      However, if the vendor changes order status, that won’t change main order status. As one order may have many sub orders.

    • #190455
      Chris
      Participant

      Alright, noted & thanks.

    • #190463

      Hope the query is solved .We are closing this thread as of now . If you need any help in future please open a new thread .

    • #190471
      kevajo
      Participant

      okay

Viewing 13 reply threads

The topic ‘sync suborder status with parent order status’ is closed to new replies.