Maxim

Maxim

Last updated on Oct 8, 2026

Updates a sale. Only the fields you pass are changed, the rest stay as they were.

v1/orders/edit.php

Parameters

Field Type Required Description
order_id int Yes Sale ID
num string No Sale number without the prefix
products array No Product lines. Replace the current lines as a whole
materials array No Material lines. Replace the current lines as a whole
customer_id int No Customer ID
customer_name string No Customer name and the customer_ fields
date_placed string No Sale date
date_shipped string No Shipping date. An empty string clears it
products_storage_id int No Products storage location
materials_storage_id int No Materials storage location
production int No 1 turns on made-to-order production, 0 turns it off
delivery_price float No Delivery cost
discount float No Discount
notes string No Notes

The status and the payment status are not changed by this method; use v1/orders/update_status and v1/orders/update_payment.

Sale lines

Lines are passed as the products and materials arrays. If at least one of the arrays is passed, the lines are replaced as a whole, and the array that is not passed is treated as empty. If neither is passed, the lines are unchanged.

Field Type Required Description
id int id or sku Product or material ID
sku string id or sku SKU. A product is also matched by its alternative SKUs
amount float Yes Quantity
total float Yes Line total (not the price per unit)

The lines from the v1/orders/get_entry response can be sent back unchanged.

Example request

Add a discount and change the notes without touching the lines or the customer:

{
    "order_id": 43727,
    "discount": 1500,
    "notes": "Discount by promo code"
}

Replace the sale's lines:

{
    "order_id": 43727,
    "products": [
        {
            "sku": "P001",
            "amount": 3,
            "total": 39000
        }
    ]
}

Example response

{
    "success": true
}

Errors

Error Reason
No order_id in input order_id is missing
Order not found or access denied Sale not found or deleted
Products is not an array products is not an array (same for materials)
No products or materials in input Empty products and materials were passed
Materials in orders are disabled in company settings Materials were passed, but the Enable ordering materials setting is off
All products have wrong SKU or id No line was found (with materials, "All products and materials have wrong SKU or id")
Storage ID is not set An empty storage location was passed
Storage ID not found Storage location not found or deleted
Date is not a valid date in format YYYY-MM-DD Invalid date
Invalid delivery_price value. Must be a number, 0 or greater Delivery cost is not a number or below 0
Invalid discount value. Must be a number, 0 or greater Discount is not a number or below 0
Customer not found The customer_id customer was not found or is deleted
Customer name must not be empty Empty customer_name

Errors in individual lines (no amount or total, invalid quantity) are the same as in v1/orders/add.