Update Line Items
Line Items
Update Line Items
Update report data and cost of goods for line items
POST
Update Line Items
Overview
Update financial fields on line items (report data) and cost of goods records. Supports updating specific line items by ID or bulk-updating all line items matching a SKU. The endpoint accepts two mutually exclusive modes:- Items mode — update specific line items by Shopify line item ID and order ID
- By SKU mode — update all line items matching a SKU
Items Mode
Target specific line items by Shopify line item ID and order ID.Array of line item update objects (max 100 per request).
Example
By SKU Mode
Update all line items matching a SKU value for your shop.The SKU value to match.
Fields to update. Required when
recalculate is not true. See Updatable Fields below.Set to
true to trigger recalculation for all matching line items.Example
Updatable Fields
Only the following fields are accepted. Unknown fields will be rejected.| Field | Type | Description |
|---|---|---|
costOfItem | Number | Cost of goods for this line item. Also updates the SKU cost of goods record (creates one if it does not exist). |
commission | Number | Commission amount |
commissionPlan | String | Commission plan label (e.g. “14%“) |
deduction | Number | Vendor deduction |
payout | Number | Vendor payout amount |
shipping | Number | Shipping amount |
sales | Number | Sales amount |
salesAfterDiscount | Number | Sales after discount |
tax | Number | Tax amount |
tcs | Number | TCS amount |
taxOnCommissions | Number | Tax on commissions |
totalGlobalDeductions | Number | Global deductions |
discount | Number | Discount amount |
Recalculate Mode
You can trigger the recalculation pipeline by settingrecalculate: true. This re-runs the full commission and payout calculations using current shop settings. Recalculation is asynchronous — the response confirms it has been queued, not completed.
You can combine fields with recalculate: true to update fields first, then recalculate. This is useful when you want to set a new cost of goods and immediately recalculate the payout based on that value.
Response
Success
Possiblestatus values: "updated", "recalculate_queued", "updated_and_recalculate_queued".
200
Partial Failure
When some items succeed and others fail, the response includes both results and errors.200
Validation Error
422
Important Notes
When
costOfItem is included in fields, the SKU cost of goods record is automatically updated (or created if it does not exist). This ensures future recalculations use the correct COGS value.- Shop isolation: All updates are scoped to your authenticated shop. You cannot update line items belonging to other shops.
- Max 100 items per request when using items mode.
- Mutually exclusive modes: Provide either
itemsorbySku, not both.