Skip to main content

Delete Order Item

Delete an existing order item.

HTTP Request

DELETE/api/orders/:id/items/:item_id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff with OrderItemPermission or Admin
  • Permission Code: 2224
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the order to delete
item_idIntegerYesUnique ID of the order item to delete

Example Requests

1import requests
2
3response = requests.delete('http://www.example.com/api/orders/123/items/789', 
4  headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())

Response Fields

FieldTypeDescription
idIntegerUnique ID of the order
keyStringUnique key of the order (read-only)
statusStringCurrent status of the order
customer_dataObjectCustomer information (read-only)
payment_method_dataObjectPayment method information (read-only)
shipping_method_dataObjectShipping method information (read-only)
shipping_costNumberCost of shipping
notesStringOrder notes
extraObjectAdditional order data
created_atString (ISO 8601)Timestamp when order was created
updated_atString (ISO 8601)Timestamp when order was last updated
billing_country_dataObjectBilling country information (read-only)
billing_state_dataObjectBilling state information (read-only)
billing_city_dataObjectBilling city information (read-only)
billing_addressStringBilling address
billing_postal_codeStringBilling postal code
billing_national_codeStringBilling national code
billing_mobile_numberStringBilling mobile number
billing_first_nameStringBilling first name
billing_last_nameStringBilling last name
countIntegerNumber of items in order (computed field)
quantityIntegerTotal quantity of items (computed field)
items_subtotalNumberSubtotal of all items (computed field)
items_discountNumberTotal discount on items (computed field)
subtotalNumberOrder subtotal (computed field)
total_discountNumberTotal discount amount (computed field)
totalNumberOrder total amount (computed field)
amount_paidNumberAmount already paid (computed field)
amount_outstandingNumberOutstanding amount (computed field)
is_paidBooleanWhether order is fully paid (computed field)
itemsArrayList of order items (read-only)
paymentsArrayList of order payments (read-only)

Customer Structure

The customer object contains:

FieldTypeDescription
idIntegerCustomer ID
usernameStringCustomer username
mobile_numberStringCustomer mobile number
first_nameStringCustomer first name
last_nameStringCustomer last name
full_nameStringCustomer full name (computed)

Payment Method Structure

The payment_method object contains:

FieldTypeDescription
idIntegerPayment method ID
nameStringPayment method name
imageObjectPayment method image data

Shipping Method Structure

The shipping_method object contains:

FieldTypeDescription
idIntegerShipping method ID
nameStringShipping method name
imageObjectShipping method image data

Geographic Data Structures

Country, state, and city objects contain:

Country/State:

FieldTypeDescription
idIntegerLocation ID
nameStringLocation name
codeStringLocation code

City:

FieldTypeDescription
idIntegerCity ID
nameStringCity name

Order Items Structure

Each item in the items array contains:

FieldTypeDescription
idIntegerUnique ID of the order item
productIntegerUnique ID of the product
product_nameStringCurrent Product Name
product_dataJsonFieldSnapshot of product data at time of order
unit_priceIntegerPrice per unit (in smallest currency unit)
unit_discountIntegerDiscount per unit (in smallest currency unit)
quantityIntegerQuantity ordered
notesStringItem-specific notes
subtotalIntegerCalculated subtotal (computed field)
discountIntegerTotal discount for this item (computed field)
totalIntegerFinal total for this item (computed field)
created_atString (ISO 8601)Item creation timestamp
updated_atString (ISO 8601)Item last update timestamp

Order Payment Structure

Each item in the payments array contains:

  • The shipping method structure here is the same as the above-mentioned ShippingMethod Structure.
FieldTypeDescription
idIntegerId of the order payment
payment_method_dataObjectPayment method data of the order payment
approvedBooleanWhether the order payment is approved
amountIntegerThe order payment amount
transaction_idStringThe transaction id of the order payment
notesStringThe extra notes about the order payment
created_atString (ISO 8601)The creation datetime of the order payment
updated_atString (ISO 8601)The last updated datetime of the order payment

Example Response

{
"id": 2,
"key": "0c86ab758d3e236cb5a4",
"status": "shipped",
"customer_data": {
"id": 1,
"username": "BehroozGhorbani",
"mobile_number": "09308744204",
"first_name": "بهروز",
"last_name": "قربانی",
"full_name": "بهروز قربانی"
},
"payment_method_data": {
"id": 1,
"name": "پرداخت در مخل",
"image": null
},
"shipping_method_data": {
"id": 1,
"name": "پیک موتور",
"image": {
"id": 8,
"type": "image",
"name": "پیک موتوری",
"size": 808754,
"human_readable_size": "789.80 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/12/20/Fantasticheskie_kartinki_dlja_monitora_68_63.jpg",
"width": 1920,
"height": 1080,
"mode": "RGB"
}
},
"shipping_cost": 75000,
"notes": "Facilis sequi alias optio. Alias ipsam deserunt. At veniam nam et. Et aut id id aut quae non animi. Sed tempora aut ut ipsa dicta vel eveniet et aspernatur.",
"extra": {
"some": "data"
},
"created_at": "2025-12-27T18:17:09.771123Z",
"updated_at": "2025-12-28T11:28:47.290350Z",
"billing_country_data": {
"id": 1,
"name": "ایران",
"code": "IR"
},
"billing_state_data": {
"id": 1,
"name": "آذربایجان شرقی",
"code": "EA"
},
"billing_city_data": {
"id": 1,
"name": "اسکو"
},
"billing_address": "5411 Stokes Grove",
"billing_postal_code": "1234567890",
"billing_national_code": null,
"billing_mobile_number": "09523296536",
"billing_first_name": "پدرام",
"billing_last_name": "زمانی",
"count": 0,
"quantity": 0,
"items_subtotal": 0,
"items_discount": 0,
"subtotal": 0,
"total_discount": 0,
"total": 75000,
"amount_paid": 500000,
"amount_outstanding": -425000,
"is_paid": true,
"is_payable": true,
"items": [],
"payments": [
{
"id": 1,
"payment_method_data": {
"id": 1,
"name": "پرداخت در مخل",
"image": null
},
"approved": true,
"amount": 500000,
"transaction_id": "1589800",
"notes": "",
"created_at": "2025-12-28T10:43:38.509103Z",
"updated_at": "2025-12-28T10:43:38.509107Z"
}
]
}

Notes

  • Deletion here returns a 200 OK response with the whole order instance data