add line item with meta to order using API
-
I’m using the latest 2.7 RC and I’m trying to create an order with a line item that has the “meta” field.
$woocommerce->post(‘orders’, [
‘status’ => ‘pending’,
‘customer_id’ => 0,
‘line_items’ => [
‘product_id’ => $productID,
‘quantity’ => 1,
‘meta’ => [
[
‘label’ => ‘Color’,
‘key’ => ‘color’,
‘value’ => ‘Blue’
],
[
‘label’ => ‘Fabric’,
‘key’ => ‘fabric’,
‘value’ => ‘Cotton’
]
]
]
]);The product is added to the order without any errors but the meta fields are not added. Am I missing something?
- The topic ‘add line item with meta to order using API’ is closed to new replies.