Skip to content

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_variant

Costs 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

  • idstringRequired

    Selling plan ID

Headers

  • X-Auth-TokenstringRequired

    API key for authentication

Request body

  • shopify_variant_idsarray of integersRequired

    Array of Shopify variant IDs to add

Returns

  • successboolean
    Example: true
  • messagestring
    Example: 2 variants added to selling plan
  • variants_addedarray of integers

    List 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
    ]
  }'
Response
{
  "success": true,
  "message": "2 variants added to selling plan",
  "variants_added": [
    43900910010503,
    43900910010999
  ]
}