We have taken over the management of some of our vendor’s logistics so we have multiple vendors with products that are shipping out of our own warehouses. However multivendor x pro is still creating sub orders for these vendors which doesn’t make sense.
We cannot take the vendors out of the plugin since all the products and shipping classes are all connected to the vendor and it would make things difficult.
To resolve this we have decided that it would be a good idea to just restrict specific vendor orders from being split into sub orders. Is this possible?
I wrote this code but its for the wcmp plugin and I am not so familiar with multi vendor x. Maybe you can write something better and more simple?
function exclude_order_splitting_for_specific_vendors( $order_id ) {
$order = wc_get_order( $order_id );
$vendor_id = get_post_meta( $order_id, ‘_wcmp_vendor_id’, true );
$excluded_vendor_ids = array( 1, 2, 3 );
if ( in_array( $vendor_id, $excluded_vendor_ids ) ) {
// If the vendor is excluded, mark the order as non-split
$order->update_meta_data( ‘_wcmp_non_split_order’, ‘yes’ );
$order->save();
}
}
add_action( ‘woocommerce_new_order’, ‘exclude_order_splitting_for_specific_vendors’ );