Untitled
unknown
plain_text
a month ago
917 B
4
Indexable
Never
add_action('woocommerce_checkout_order_processed', 'marketking_set_order_status_parent', 100000, 3); function marketking_set_order_status_parent($order_id, $posted_data = array(), $order = array()){ $orderobj = wc_get_order($order_id); $statuses_set = $orderobj->get_meta('marketking_order_statuses_set'); if ($statuses_set !== 'yes'){ if (marketking()->is_multivendor_order($order_id)){ $order = wc_get_order($order_id); $pre_status = $order->get_status(); $suborders = marketking()->get_suborders_of_order($order_id); foreach ($suborders as $suborder){ $suborder->set_status( $pre_status ); $suborder->save(); } // for main order, set the status to composite $order->update_status('wc-composite'); $order->update_meta_data('marketking_composite','yes'); $order->save(); } $orderobj->update_meta_data('marketking_order_statuses_set','yes'); $orderobj->save(); } }
Leave a Comment