Patch Order Cart
curl --request PATCH \
--url 'https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order' \
--header 'Content-Type: application/json' \
--data '
{
"action_type": "<string>",
"order_item_id": "<string>",
"quantity": 123,
"item_id": "<string>",
"special_instructions": "<string>"
}
'import requests
url = "https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order"
payload = {
"action_type": "<string>",
"order_item_id": "<string>",
"quantity": 123,
"item_id": "<string>",
"special_instructions": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
action_type: '<string>',
order_item_id: '<string>',
quantity: 123,
item_id: '<string>',
special_instructions: '<string>'
})
};
fetch('https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'action_type' => '<string>',
'order_item_id' => '<string>',
'quantity' => 123,
'item_id' => '<string>',
'special_instructions' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order"
payload := strings.NewReader("{\n \"action_type\": \"<string>\",\n \"order_item_id\": \"<string>\",\n \"quantity\": 123,\n \"item_id\": \"<string>\",\n \"special_instructions\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order")
.header("Content-Type", "application/json")
.body("{\n \"action_type\": \"<string>\",\n \"order_item_id\": \"<string>\",\n \"quantity\": 123,\n \"item_id\": \"<string>\",\n \"special_instructions\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"action_type\": \"<string>\",\n \"order_item_id\": \"<string>\",\n \"quantity\": 123,\n \"item_id\": \"<string>\",\n \"special_instructions\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"original_subtotal": "<string>",
"tax_amount": "<string>",
"original_price": "<string>",
"partner": "<string>",
"special_instructions": "<string>",
"customer": {},
"fulfillments": [
{
"fulfillmentsLogs": [
{
"date_created": "<string>",
"description": "<string>",
"order_status_title": "<string>",
"employee": {}
}
]
}
],
"orderItems": [
{}
]
}Orders
Patch Order Cart
Modify order items by adding, removing, or updating quantities after order creation but before completion.
PATCH
{micro_service_base_url}
/
orders
/
{order_id}
/
patch-order
Patch Order Cart
curl --request PATCH \
--url 'https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order' \
--header 'Content-Type: application/json' \
--data '
{
"action_type": "<string>",
"order_item_id": "<string>",
"quantity": 123,
"item_id": "<string>",
"special_instructions": "<string>"
}
'import requests
url = "https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order"
payload = {
"action_type": "<string>",
"order_item_id": "<string>",
"quantity": 123,
"item_id": "<string>",
"special_instructions": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
action_type: '<string>',
order_item_id: '<string>',
quantity: 123,
item_id: '<string>',
special_instructions: '<string>'
})
};
fetch('https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'action_type' => '<string>',
'order_item_id' => '<string>',
'quantity' => 123,
'item_id' => '<string>',
'special_instructions' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order"
payload := strings.NewReader("{\n \"action_type\": \"<string>\",\n \"order_item_id\": \"<string>\",\n \"quantity\": 123,\n \"item_id\": \"<string>\",\n \"special_instructions\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order")
.header("Content-Type", "application/json")
.body("{\n \"action_type\": \"<string>\",\n \"order_item_id\": \"<string>\",\n \"quantity\": 123,\n \"item_id\": \"<string>\",\n \"special_instructions\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/{{micro_service_base_url}}/orders/{{order_id}}/patch-order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"action_type\": \"<string>\",\n \"order_item_id\": \"<string>\",\n \"quantity\": 123,\n \"item_id\": \"<string>\",\n \"special_instructions\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"original_subtotal": "<string>",
"tax_amount": "<string>",
"original_price": "<string>",
"partner": "<string>",
"special_instructions": "<string>",
"customer": {},
"fulfillments": [
{
"fulfillmentsLogs": [
{
"date_created": "<string>",
"description": "<string>",
"order_status_title": "<string>",
"employee": {}
}
]
}
],
"orderItems": [
{}
]
}This endpoint allows you to modify order contents after the order has been created but before it’s completed. You can remove items, reduce quantities, add new items, or update existing items. This is useful for handling out-of-stock situations, customer requests, or inventory adjustments.
Order modifications should only be made with customer approval and may affect the final order price. Always communicate changes to the customer.
Path Parameters
string
required
The unique identifier of the order to modify
Request Body
The request body should be an array of action objects, each specifying a modification to perform:string
required
Type of modification: “remove_item”, “reduce_quantity”, “add_item”, “update_item”
string
required
The unique identifier of the order item to modify (required for remove_item, reduce_quantity, update_item)
integer
New quantity for the item (required for reduce_quantity and add_item actions)
string
Product identifier (required for add_item actions)
string
Updated special instructions for the item
Response
string
Updated order identifier
string
Updated order subtotal after modifications
string
Recalculated tax amount
string
Updated original price
string
Delivery platform name
string
Order-level special instructions
object
Customer information remains unchanged
array
Updated fulfillment information with modification logs
array
Updated array of order items after modifications
Request Example
[
{
"action_type": "remove_item",
"order_item_id": "35bf2e22-a70f-4dda-9de0-eb92ee581d4a"
},
{
"action_type": "reduce_quantity",
"order_item_id": "3133710b-6d3e-4533-8d67-26c7a4a93e29",
"quantity": 2
}
]
Response Example
{
"id": "a8e2c9ee-0bbd-4e86-ab2c-40e94297b3bd",
"original_subtotal": "-35.26",
"is_auto_accepted": false,
"order_id": null,
"tax_amount": "NaN",
"discount": null,
"original_price": null,
"createdAt": "2024-07-04T12:06:57.740Z",
"partner": "DoorDash",
"special_instructions": "Cancel the order if the first item is not Present",
"exclude_allergens_items": "",
"is_include_disposables": false,
"store_id": "449235c1-3d04-4519-998b-40d2a621e5e0",
"dsp_order_number": "",
"custom_fee": null,
"tax_remitted": "NaN",
"customer": {
"customer_name": "Lula D.",
"contact_phone": "+1 312-766-6835",
"phone_code": null
},
"fulfillments": [
{
"quantity": null,
"date_ready": null,
"createdAt": "2024-07-04T12:06:57.756Z",
"estimated_date_delivered": "2024-07-04T12:17:14.540Z",
"id": "2f71af29-e115-42f1-839f-1137efa73c8a",
"store_id": "449235c1-3d04-4519-998b-40d2a621e5e0",
"fulfillmentStatus": {
"delivery_status_name": "waiting"
},
"fulfillmentsLogs": [
{
"date_created": "2024-07-04T12:06:57.758Z",
"description": "DoorDash store mock order received",
"order_status_title": "Order received",
"fulfillments_id": "2f71af29-e115-42f1-839f-1137efa73c8a",
"employee": null
},
{
"date_created": "2024-07-04T12:07:14.577Z",
"description": "",
"order_status_title": "Bagging order",
"fulfillments_id": "2f71af29-e115-42f1-839f-1137efa73c8a",
"employee": {
"id": "f78c06a0-8a0f-4d0b-a5d1-d7d2b0ffde70",
"first_name": "Salman",
"last_name": "Saeed Paul"
}
},
{
"date_created": "2024-07-04T12:07:56.205Z",
"description": "Removing [1] 'Cheetos Flamin' Hot Cheese Flavored Snacks'.",
"order_status_title": "Item quantity edited",
"fulfillments_id": "2f71af29-e115-42f1-839f-1137efa73c8a",
"employee": {
"id": "f78c06a0-8a0f-4d0b-a5d1-d7d2b0ffde70",
"first_name": "Salman",
"last_name": "Saeed Paul"
}
}
]
}
],
"orderItems": []
}
Available Action Types
Available Action Types
remove_item
- Completely removes an item from the order
- Requires: order_item_id
- Use when item is out of stock or customer requests removal
- Reduces the quantity of an existing item
- Requires: order_item_id, quantity (new quantity, not amount to reduce)
- Use for partial availability or customer quantity changes
- Adds a new item to the order
- Requires: item_id, quantity
- Optional: special_instructions
- Use for customer additions or substitutions
- Updates item details without changing quantity
- Requires: order_item_id
- Optional: special_instructions, item modifications
- Use for customization changes
Price Recalculation: The system automatically recalculates taxes, fees, and total price after modifications. Negative subtotals in the response indicate cost reductions.
Best Practice: Always batch multiple modifications into a single request to avoid multiple price recalculations and to maintain order consistency.
Error Responses
Common Error Scenarios
Common Error Scenarios
Invalid Order ItemOrder Not ModifiableInvalid Quantity
{
"error": "Order item not found",
"order_item_id": "invalid-id"
}
{
"error": "Order cannot be modified in current status",
"current_status": "completed"
}
{
"error": "Quantity must be greater than 0",
"provided_quantity": 0
}
Status Restrictions: Orders can only be modified in certain statuses (pending, accepted, in_progress). Completed, canceled, or delivered orders cannot be modified.
Use Cases
Common Modification Scenarios
Common Modification Scenarios
Out of Stock Items
- Remove unavailable items
- Reduce quantities for partial availability
- Add substitute items with customer approval
- Add items to existing order
- Remove items customer no longer wants
- Modify special instructions
- Reduce quantities when stock is lower than expected
- Remove items due to quality issues
- Update item specifications
- Adjust item quantities for pricing corrections
- Remove incorrectly priced items
- Add corrected items

