Skip to content

Update products

BetaAPI v2 is in public beta: endpoints, fields and behaviour can change before general availability. See the changelog

PATCH
/preorders/products
curl --request PATCH \
--url https://app.stoqapp.com/api/v2/external/preorders/products \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <X-Auth-Token>' \
--data '{ "variants": "string", "inventory_policy": "string" }'

Save rows of the store-wide Preorders > Products tab: link each variant to one offer or to none, and set its shipping text and quantity limit on the offers it is in.

Note: variants is a list of up to 100 rows. A row’s offer_id replaces every offer the variant is in with that one, and null takes it out of all of them, as the tab’s ‘Offer linked’ select does; omit offer_id to leave the links. Offers that sell in selected markets only cannot be picked, and a variant in one is skipped (skipped_market_shopify_variant_ids); change those on the offer itself. offers sets this variant’s shipping_text and max_count on offers it is in; shipping_text only on an offer whose shipping text is per variant, max_count (1 or more) only on an out-of-stock offer. null clears either one; a key left out is unchanged. max_count is the variant’s own limit, the same field GET /preorders/products returns, so writing a read value back changes nothing; on a batch offer it is kept but not enforced (limits there are per batch, set on the offer’s variant row with batch_limits), and quantity_limit is read-only. inventory_policy (CONTINUE or DENY) also sets ‘Continue selling’ on the variants whose offer_id changed, as the save confirm’s Turn on / Turn off does; omit it for ‘Don’t change’. Variants STOQ has not stored yet are read from Shopify. Finishes before the response.

Media typeapplication/json
object
variants
inventory_policy

Example

{
"variants": "string",
"inventory_policy": "string"
}

Success — the updated resource.

Media typeapplication/json
object

Example generated

{}

Accepted — async/bulk work was queued. Poll the returned job.

Media typeapplication/json

Returned for async/bulk work — poll the job until it reaches a terminal state.

object
job_id
string
status_url
string

Example

{
"job_id": "job_a1b2c3",
"status_url": "/api/v2/external/jobs/job_a1b2c3"
}

Missing or invalid X-Auth-Token.

Media typeapplication/json

Error envelope returned by every failed request.

object
errors
required
Array<string>

Example

{
"errors": [
"Unauthorized"
]
}

The request failed validation.

Media typeapplication/json

Error envelope returned by every failed request.

object
errors
required
Array<string>

Example

{
"errors": [
"name is required"
]
}

Rate limited — cost-weighted per token (read 1, write 2; 360 points / 60s). Check Retry-After.

Media typeapplication/json

Error envelope returned by every failed request.

object
errors
required
Array<string>

Example

{
"errors": [
"Rate limit exceeded"
]
}
Was this page helpful?

Still stuck? Ask Quinn or chat with support