Draft order lines
The lines of a draft order, in the order they were added: one variant each, how many of it, its price for the draft's customer, its product as the draft's view shows it and the units in stock. Every write of a line prices the draft again.
List draft order lines
Lists the draft's lines in the order they were added and only so, all of them in one page by default — a draft holds at most 250 — each with its product as the draft's view shows it and, for a tracked variant, the units in stock (available). Read as a Get reads the draft: an open one due a reprice is priced again first. Neither filters nor sorts.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
query Parameters
page_sizeRows per page. Over the maximum is clamped, not rejected.
page_tokenOpaque token from a previous next_page_token. A token minted under a different order_by/filter is rejected.
skipRows to skip before the page (AIP-158). skip + page_size is capped at 10000; beyond that is OUT_OF_RANGE.
order_byComma-separated field [asc|desc], at most 3 keys. Default: create_time desc. Sortable: none — this collection serves its documented order only.
filterAIP-160 subset (§8). Filterable: none. A field outside the list is INVALID_ARGUMENT.
List draft order lines › Responses
One page of lines.
This page of lines, in the requested order.
next_page_tokenOpaque. Absent or empty means this was the last page.
total_sizeRows in the whole filtered collection, not in this page.
Create draft order line
Puts a variant into the draft: {"variant_id": "…", "quantity": 2}. A variant the draft holds already adds the quantity to its line. The variant must be on sale on the draft's view and priced in its currency, else INVALID_ARGUMENT on variant_id; a quantity is 1 to 100000 — the line's after the add too — else INVALID_ARGUMENT on quantity; a tracked variant is held to its stock — FAILED_PRECONDITION OUT_OF_STOCK with variant_id and available; a 251st line DRAFT_ORDER_LINES_LIMIT; a COMPLETED draft DRAFT_ORDER_COMPLETED. The draft is priced again: read it for its totals. Answers 201 and the line.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
Create draft order line › Request Body
quantityHow many units: 1 to 100000 — the line's after an add too. A variant whose stock is tracked is held to it: more than is in stock is OUT_OF_STOCK.
variant_idThe variant of the catalog the line holds: one on sale on the draft's view — the variant and its product on, the product shown there — and priced in its currency, else refused on it. Required on create, fixed afterwards; a variant the draft holds already adds to its line.
price_overrideThe line's own price, given by the shop's user in the catalog's place — agreed with the customer, marked down, a replacement at no cost: {unit_price, reason?}, unit_price a google.type.Money in the draft's currency, to its minor unit and never below zero — zero gives the line away — and reason why, at most 200 characters. Written by an Update of the line (update_mask=price_override), refused PRICE_OVERRIDE_DISABLED where the draft's capabilities do not name PRICE_OVERRIDE; null there gives the line the catalog's price again. The line is priced by the catalog all the same — its variant must still be sold on the view — and keeps the own price through every later pricing of the draft, a quantity changed or an add of its variant too; a move to a view of another currency takes it off (price_changes.price_overrides_dropped). Absent on a line the catalog prices.
Create draft order line › Responses
The created resource.
nameThe line's resource name: websites/{website}/draft_orders/{draft_order}/lines/{line}.
idThe line's id within its draft: 8 characters.
variant_idThe variant of the catalog the line holds: one on sale on the draft's view — the variant and its product on, the product shown there — and priced in its currency, else refused on it. Required on create, fixed afterwards; a variant the draft holds already adds to its line.
quantityHow many units: 1 to 100000 — the line's after an add too. A variant whose stock is tracked is held to it: more than is in stock is OUT_OF_STOCK.
product_idThe product of the catalog the variant belongs to.
skuThe variant's SKU when the line was last priced.
display_nameThe product's name as the draft's view shows it, in its language. Absent when the view no longer serves the product — switched off, hidden there, deleted — and the next pricing of every line takes the line out.
variant_optionsThe variant's values along its product's axes: [{key, display_name, value, label}], named in the view's language. Empty for a product without options.
image_media_idThe picture of the line's variant — its own first one, else its product's — as websites/{website}/media/{image_media_id}. Absent without one.
unit_priceWhat one unit costs the draft's customer — a guest, when it has none: {regular?, final, source, source_id?} — final what is paid, regular the regular price beside it, source whose final is (REGULAR, SALE, PRICE_LIST, RULE) and source_id the price list or the last price rule it came from. The price the checkout gives the same customer on the same view — unless the line has its own price: final is then price_override.unit_price, source MANUAL, and regular the catalog's price beside it — its regular one, else the one it would charge the customer.
price_overrideThe line's own price, given by the shop's user in the catalog's place — agreed with the customer, marked down, a replacement at no cost: {unit_price, reason?}, unit_price a google.type.Money in the draft's currency, to its minor unit and never below zero — zero gives the line away — and reason why, at most 200 characters. Written by an Update of the line (update_mask=price_override), refused PRICE_OVERRIDE_DISABLED where the draft's capabilities do not name PRICE_OVERRIDE; null there gives the line the catalog's price again. The line is priced by the catalog all the same — its variant must still be sold on the view — and keeps the own price through every later pricing of the draft, a quantity changed or an add of its variant too; a move to a view of another currency takes it off (price_changes.price_overrides_dropped). Absent on a line the catalog prices.
line_totalunit_price.final × quantity.
tax_rateThe rate the line pays, a percentage as a decimal string — the rate its product's tax class has in the draft's country, else that country's standard one. Absent on a line that is not taxed.
tax_amountThe tax of the line, rounded on its own, on its line_total: on top of it, or the part of it that is tax when the prices hold it. Absent on a line that is not taxed.
availableHow many units of the variant are in stock now, when its stock is tracked (inventory_levels/{variant_id}); absent, it is sold in any quantity. A line holding more is the draft's OUT_OF_STOCK issue.
priced_atWhen the line's price was last resolved.
Delete draft order line
Takes a line out of the draft, which is priced again.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
line_idId of the parent line.
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Delete draft order line › Responses
Deleted. No body (§7).
Update draft order line
Sets a line's quantity: {"quantity": 3} (update_mask=quantity), 1 to 100000 and held to a tracked stock as an add is. variant_id is fixed: refused here. Answers the line.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
line_idId of the parent line.
query Parameters
update_maskComma-separated field paths to merge. A field named here and sent as null is cleared; without the mask a null is dropped (§7, §11).
Headers
If-MatchThe etag the client last read. A mismatch is ABORTED (409) with the current resource in the error details (§14).
Update draft order line › Request Body
quantityHow many units: 1 to 100000 — the line's after an add too. A variant whose stock is tracked is held to it: more than is in stock is OUT_OF_STOCK.
price_overrideThe line's own price, given by the shop's user in the catalog's place — agreed with the customer, marked down, a replacement at no cost: {unit_price, reason?}, unit_price a google.type.Money in the draft's currency, to its minor unit and never below zero — zero gives the line away — and reason why, at most 200 characters. Written by an Update of the line (update_mask=price_override), refused PRICE_OVERRIDE_DISABLED where the draft's capabilities do not name PRICE_OVERRIDE; null there gives the line the catalog's price again. The line is priced by the catalog all the same — its variant must still be sold on the view — and keeps the own price through every later pricing of the draft, a quantity changed or an add of its variant too; a move to a view of another currency takes it off (price_changes.price_overrides_dropped). Absent on a line the catalog prices.
Update draft order line › Responses
The updated resource.
nameThe line's resource name: websites/{website}/draft_orders/{draft_order}/lines/{line}.
idThe line's id within its draft: 8 characters.
variant_idThe variant of the catalog the line holds: one on sale on the draft's view — the variant and its product on, the product shown there — and priced in its currency, else refused on it. Required on create, fixed afterwards; a variant the draft holds already adds to its line.
quantityHow many units: 1 to 100000 — the line's after an add too. A variant whose stock is tracked is held to it: more than is in stock is OUT_OF_STOCK.
product_idThe product of the catalog the variant belongs to.
skuThe variant's SKU when the line was last priced.
display_nameThe product's name as the draft's view shows it, in its language. Absent when the view no longer serves the product — switched off, hidden there, deleted — and the next pricing of every line takes the line out.
variant_optionsThe variant's values along its product's axes: [{key, display_name, value, label}], named in the view's language. Empty for a product without options.
image_media_idThe picture of the line's variant — its own first one, else its product's — as websites/{website}/media/{image_media_id}. Absent without one.
unit_priceWhat one unit costs the draft's customer — a guest, when it has none: {regular?, final, source, source_id?} — final what is paid, regular the regular price beside it, source whose final is (REGULAR, SALE, PRICE_LIST, RULE) and source_id the price list or the last price rule it came from. The price the checkout gives the same customer on the same view — unless the line has its own price: final is then price_override.unit_price, source MANUAL, and regular the catalog's price beside it — its regular one, else the one it would charge the customer.
price_overrideThe line's own price, given by the shop's user in the catalog's place — agreed with the customer, marked down, a replacement at no cost: {unit_price, reason?}, unit_price a google.type.Money in the draft's currency, to its minor unit and never below zero — zero gives the line away — and reason why, at most 200 characters. Written by an Update of the line (update_mask=price_override), refused PRICE_OVERRIDE_DISABLED where the draft's capabilities do not name PRICE_OVERRIDE; null there gives the line the catalog's price again. The line is priced by the catalog all the same — its variant must still be sold on the view — and keeps the own price through every later pricing of the draft, a quantity changed or an add of its variant too; a move to a view of another currency takes it off (price_changes.price_overrides_dropped). Absent on a line the catalog prices.
line_totalunit_price.final × quantity.
tax_rateThe rate the line pays, a percentage as a decimal string — the rate its product's tax class has in the draft's country, else that country's standard one. Absent on a line that is not taxed.
tax_amountThe tax of the line, rounded on its own, on its line_total: on top of it, or the part of it that is tax when the prices hold it. Absent on a line that is not taxed.
availableHow many units of the variant are in stock now, when its stock is tracked (inventory_levels/{variant_id}); absent, it is sold in any quantity. A line holding more is the draft's OUT_OF_STOCK issue.
priced_atWhen the line's price was last resolved.
Batch create (draft order lines)
Puts up to 250 variants into the draft in one call: {"lines": [{"variant_id": "…", "quantity": 1}, …]}, each as POST lines takes one. All or none: a refused entry answers for the whole call on its own fields (lines[3].variant_id), and nothing is written. Answers {"lines": […]} — the line of each entry, in the entries' order.
path Parameters
website_idId of the parent website.
draft_order_idId of the parent draft_order.
Batch create (draft order lines) › Request Body optional
Batch create (draft order lines) › Responses
The affected resource, or the method’s own response object (§10).