Shipping won’t save
-
I’m trying to copy the shipping from a parent order into the child order. I get the shipping rate out of the parent order just fine, when when I save it, I never see the items in the order object modified. After the order finishes with payment complete, the shipping is still set to default instead of the parent order.
Here is my code. Is there a mistake in the way I’m trying to set this?
$shippingRate = array_pop($parentOrder->get_items('shipping')); if ($shippingRate) { $order->add_item(new WC_Order_Item_Shipping([ 'method_title' => $shippingRate->method_name, 'method_id' => $shippingRate->method_id, 'instance_id' => $shippingRate->instance_id, 'total' => $shippingRate->total, 'total_tax' => $shippingRate->total_tax, ])); $order->save(); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Shipping won’t save’ is closed to new replies.