---
title: "Add multiple product variants to a selling plan"
description: "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 wi"
url: https://docs.stoqapp.com/v1/preorders/add-multiple-product-variants-to-a-selling-plan/
api: "API v1 (legacy)"
method: POST
path: "/external/preorders/{id}/add_variant"
---

# Add multiple product variants to a selling plan

`POST https://app.stoqapp.com/api/v1/external/preorders/{id}/add_variant`

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

- `id` (string, required): Selling plan ID

## Headers

- `X-Auth-Token` (string, required): API key for authentication

## Request body

- `shopify_variant_ids` (array of integers, required): Array of Shopify variant IDs to add

## Returns

- `success` (boolean): e.g. `true`
- `message` (string): e.g. `2 variants added to selling plan`
- `variants_added` (array of integers): List of variant IDs that were added

Rate limit: this call costs 2 points ([rate limits](https://docs.stoqapp.com/docs/rate-limits/)).

## Example request

```sh
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
    ]
  }'
```

## 200

Variants added successfully

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

## 400

Bad request - missing or invalid shopify_variant_ids

## 401

Unauthorized

## 404

Selling plan not found

## 422

Some variants already added or other error

