Skip to content

Add multiple product variants to a selling plan

LegacyAPI v1 is the older API. It still works and is supported, but new integrations should use API v2. Migrating from v1 to v2

POST
/external/preorders/{id}/add_variant
curl --request POST \
--url https://app.stoqapp.com/api/v1/external/preorders/example/add_variant \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: <X-Auth-Token>' \
--data '{ "shopify_variant_ids": [ 43900910010503, 43900910010999 ] }'

Attach one or more Shopify product variants to a selling plan so they become available for preorder. Pass the variant IDs in shopify_variant_ids; any that are already attached are reported back under existing_variants with a 422. Returns the list of variant IDs that were newly added.

id
required
string

Selling plan ID

X-Auth-Token
required
string

API key for authentication

Media typeapplication/json
object
shopify_variant_ids
required

Array of Shopify variant IDs to add

Array<integer>

Example

{
"shopify_variant_ids": [
43900910010503,
43900910010999
]
}

Variants added successfully

Media typeapplication/json
object
success
boolean
message
string
variants_added

List of variant IDs that were added

Array<integer>

Example

{
"success": true,
"message": "2 variants added to selling plan",
"variants_added": [
43900910010503,
43900910010999
]
}

Bad request - missing or invalid shopify_variant_ids

Media typeapplication/json
object
error
string

Example generated

{
"error": "example"
}

Unauthorized

Selling plan not found

Some variants already added or other error

Media typeapplication/json
object
error
string
existing_variants

List of variant IDs that were already added

Array<integer>

Example generated

{
"error": "example",
"existing_variants": [
1
]
}
Was this page helpful?

Still stuck? Ask Quinn or chat with support