I've been searching around but can't get it to work.
Using the api v3 I'm able to get all orders and everything is ok, but now I need to be able to update a metadata, when I use insomnia I manage to update the metadata, but now I need to do it from a php script
but it just won't work.
with insomnia using put
.
{ "meta_data": [ { "key": "_mensajero", "value": "juan carlos" } ]}
and it works and update order meta, but with php
no matter what I try I cannot get it to update
<?php
if (isset($_POST['btn-update'])) {
$oid = $_POST['cId']; /////the order id
$data = [
'meta_data' => [
'_mensajero' => '_mensajero'
]
];
$woocommerce->put('orders/' . $oid, $data);
header('Location: #');
}
?>