Auto allocating stock to an updated order via the API

Hi,

I’m currently amending an order using the update order API. When I do this it amends the order correctly but I then have to manually allocate stock to it.

Is there a way to auto allocate stock so it cuts out a manual step for our dispatch team?

This is the code I’m using:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://api.veeqo.com/orders/$order_id");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

$order = [
  "order" => [
    "channel_id" => $channel_id,
    "customer_id" => $customer_id,
    "deliver_to_id" => $deliver_to_id,
    "delivery_method_id" => $delivery_method_id,
  ]
];

foreach($parcels[0] as $item) {
    $order['order']['line_items_attributes'][] = [
        "sellable_id" => $item['id'],
        "price_per_unit" => $item['price'],
        "quantity" => $item['quantity'],
    ];
}

curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($order));

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Content-Type: application/json",
  "x-api-key: 123"
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);

Hey! You will need to create a new allocation on to the order and fill in the relevant details like warehouse ID and quantity allocated etc. You can find more details here:

https://developer.veeqo.com/docs#/reference/allocations/allocation-collection/create-a-new-allocation