Add multiple product variants to a selling plan
API v1 is the older API. It still works, but new integrations should use API v2. Migrating from v1 to v2
POST
/external/preorders/{id}/add_variantCosts 2 rate-limit points · Rate limits
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.
Path parameters
idstringRequiredSelling plan ID
Headers
X-Auth-TokenstringRequiredAPI key for authentication
Request body
shopify_variant_idsarray of integersRequiredArray of Shopify variant IDs to add
Returns
successbooleanExample:truemessagestringExample:2 variants added to selling planvariants_addedarray of integersList of variant IDs that were added
Errors
400
Bad request - missing or invalid shopify_variant_ids
401
Unauthorized
404
Selling plan not found
422
Some variants already added or other error
POST/external/preorders/{id}/add_variant
curl -X POST "https://app.stoqapp.com/api/v1/external/preorders/79b44c6c-ebc7-41d4-8a1b-573d7c693454/add_variant" \
-H "X-Auth-Token: $STOQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"shopify_variant_ids": [
43900910010503,
43900910010999
]
}'const res = await fetch("https://app.stoqapp.com/api/v1/external/preorders/79b44c6c-ebc7-41d4-8a1b-573d7c693454/add_variant", {
method: "POST",
headers: {
"X-Auth-Token": process.env.STOQ_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"shopify_variant_ids": [
43900910010503,
43900910010999
]
}),
});
const data = await res.json();import os
import requests
res = requests.post(
"https://app.stoqapp.com/api/v1/external/preorders/79b44c6c-ebc7-41d4-8a1b-573d7c693454/add_variant",
headers={"X-Auth-Token": os.environ["STOQ_API_KEY"]},
json={
"shopify_variant_ids": [
43900910010503,
43900910010999
]
},
)
data = res.json()require "net/http"
require "json"
uri = URI("https://app.stoqapp.com/api/v1/external/preorders/79b44c6c-ebc7-41d4-8a1b-573d7c693454/add_variant")
req = Net::HTTP::Post.new(uri, "X-Auth-Token" => ENV["STOQ_API_KEY"], "Content-Type" => "application/json")
req.body = {
shopify_variant_ids: [
43900910010503,
43900910010999
]
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)Response
{
"success": true,
"message": "2 variants added to selling plan",
"variants_added": [
43900910010503,
43900910010999
]
}No body
No body
No body
No body