MultivendorX Pro
-
AuthorPosts
-
-
March 8, 2023 at 6:34 PM #187662kevajoParticipant
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”. -
March 9, 2023 at 11:31 AM #187686Sangita Support SquadKeymaster
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/
-
March 9, 2023 at 1:07 PM #187700kevajoParticipant
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’));
}
}
} -
March 9, 2023 at 1:24 PM #187713NerdySupportExpert MoumitaKeymaster
Please check the new code from here https://multivendorx.com/docs/code-snippet/parent-order-and-sub-order-status-sync/
-
March 9, 2023 at 1:32 PM #187715kevajoParticipant
I need a code that synchronizes any status of main command and sub commands
-
March 10, 2023 at 12:33 PM #187753Sangita Support SquadKeymaster
Please add the above code we have shared in your function.php of your site. Then do some tests.
It should work perfectly fine. -
March 10, 2023 at 8:16 PM #188301kevajoParticipant
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
-
March 10, 2023 at 9:08 PM #188686kevajoParticipant
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’));
}
}
} -
March 11, 2023 at 12:20 AM #188928NerdySupportExpert MoumitaKeymaster
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 -
April 5, 2023 at 2:01 AM #190396ChrisParticipant
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?
-
April 5, 2023 at 12:21 PM #190427Sangita Support SquadKeymaster
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. -
April 6, 2023 at 12:45 AM #190455ChrisParticipant
Alright, noted & thanks.
-
April 6, 2023 at 1:16 PM #190463Sangita Support SquadKeymaster
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 .
-
April 6, 2023 at 1:47 PM #190471kevajoParticipant
okay
-
-
AuthorPosts
The topic ‘sync suborder status with parent order status’ is closed to new replies.