'Adding order item programmatically in selected woocommerce order
I'm trying to add an item into an existing selected woocommerce order programmatically with following piece of code:
$order_newitem_id = woocommerce_add_order_item( $order_id, array( 'order_item_name' => $product->get_title(), 'order_item_type' => 'line_item') );
Issue I'm running into is it is inserting a item line in a common table(wp_woocommerce_order_itemmeta) instead of multisite table (wp_2_woocommerce_order_itemmeta).
I'm setting global variable $wpdb set prefix to wp_2_, all other updates, inserts are properly inserted in multisite table except for order item. Not sure what special step I should take care.
Any help is appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
