Skip to content

Edit Product's Variant

Mehrdad Pajuhaan edited this page Oct 23, 2026 · 2 revisions

Edit Product's Variant

Variants are the purchasable versions of a product (for example color and size combinations), each with its own price, SKU and stock. This page explains which endpoint to use for each kind of variant update, and documents the full variant edit, the price-only update and the quantity-only update.

Base URL: https://api.selldone.com Auth header: Authorization: Bearer YOUR_ACCESS_TOKEN Scope: backoffice:product:write for every endpoint on this page

Choosing the right endpoint

  • To change multiple fields of a variant (price, SKU, quantity, enable, labels, dimensions…), use the full variant edit endpoint.
  • To change only the price, use the update price endpoint. It is simpler and safer.
  • To change only the quantity (stock), use the update quantity endpoint. It is simpler and safer.
Use case Endpoint Method SDK URL builder
Full edit of a single variant (many fields) /shops/{shop_id}/products/{product_id}/variants/{variant_id}/edit POST POST_EDIT_VARIANT
Update price only (product or specific variant) /shops/{shop_id}/products/{product_id}/edit/price/{variant_id?} PUT PUT_EDIT_PRODUCT_PRICE
Update quantity only (specific variant) /shops/{shop_id}/products/{product_id}/variants/{variant_id}/quantity POST POST_PRODUCT_QUANTITY

To update many variants, loop over your target variants and call the appropriate endpoint for each one. For bulk changes that affect multiple fields, prefer the full variant edit endpoint. Keep the loop within the rate limits.

Full variant edit

POST https://api.selldone.com/shops/{shop_id}/products/{product_id}/variants/{variant_id}/edit

Use this endpoint to update several attributes of a variant in one request.

Path parameters

Parameter Type Description
shop_id string Target shop ID.
product_id string Target product ID.
variant_id string Target variant ID.

Body (JSON)

Send only the fields you want to change. All fields are optional unless your business logic requires them.

Field Type Validation / notes
currency string nullable, must be in Currency::GetCurrenciesList().
pricing boolean nullable, toggles variant-specific pricing.
color string nullable.
commission number nullable, min:0.
dis_start string nullable, date (ISO 8601).
dis_end string nullable, date (>= dis_start).
discount number nullable, min:0.
enable boolean nullable.
lead number nullable, min:-1.
mpn string nullable.
price number nullable, min:0.
quantity number nullable, min:0.
sku string nullable.
price_label string nullable.
extra object nullable, dimension and weight info.
extra.weight number nullable, min:0.
extra.width number nullable, min:0.
extra.length number nullable, min:0.
extra.height number nullable, min:0.

Example request (cURL)

TOKEN="YOUR_ACCESS_TOKEN"
SHOP_ID="12345"
PRODUCT_ID="67890"
VARIANT_ID="abcde12345"

curl -X POST "https://api.selldone.com/shops/${SHOP_ID}/products/${PRODUCT_ID}/variants/${VARIANT_ID}/edit" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "enable": true,
    "sku": "TSHIRT-RED-S",
    "price": 19.99,
    "currency": "USD",
    "quantity": 42,
    "price_label": "Sale",
    "extra": { "weight": 0.3, "width": 20, "length": 25, "height": 2 }
  }'

Update price (product or variant)

PUT https://api.selldone.com/shops/{shop_id}/products/{product_id}/edit/price/{variant_id?}

Use this endpoint to update the price only.

  • If you omit variant_id, it updates the main product price.
  • If you include variant_id, it updates the price of that specific variant.

Body (JSON)

Context Fields Validation / notes
Product level (no variant_id) price (required), currency (required), pricing (optional) price: numeric; currency: in Currency::GetCurrenciesList(); pricing: must be in ProductPricing::All.
Variant level (with variant_id) price (required), currency (required), pricing (optional) price: numeric|min:0; currency: in Currency::GetCurrenciesList(); pricing: nullable|boolean.

Example: update the product price (no variant_id)

At product level, pricing is a ProductPricing value: FIX, ESTIMATION, AGREEMENT or BID (see the Product model in Selldone Core).

TOKEN="YOUR_ACCESS_TOKEN"
SHOP_ID="12345"
PRODUCT_ID="67890"

curl -X PUT "https://api.selldone.com/shops/${SHOP_ID}/products/${PRODUCT_ID}/edit/price" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 24.90,
    "currency": "USD",
    "pricing": "FIX"
  }'

Example: update a variant price

TOKEN="YOUR_ACCESS_TOKEN"
SHOP_ID="12345"
PRODUCT_ID="67890"
VARIANT_ID="abcde12345"

curl -X PUT "https://api.selldone.com/shops/${SHOP_ID}/products/${PRODUCT_ID}/edit/price/${VARIANT_ID}" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{
    "price": 19.99,
    "currency": "USD",
    "pricing": true
  }'

Update variant quantity

POST https://api.selldone.com/shops/{shop_id}/products/{product_id}/variants/{variant_id}/quantity

Use this endpoint to update the stock (quantity) of a specific variant. For a product without variants, call the same path without the variant segment: POST /shops/{shop_id}/products/{product_id}/quantity.

Body (JSON)

Field Type Validation
quantity number required, numeric, min:0

Example request (cURL)

TOKEN="YOUR_ACCESS_TOKEN"
SHOP_ID="12345"
PRODUCT_ID="67890"
VARIANT_ID="abcde12345"

curl -X POST "https://api.selldone.com/shops/${SHOP_ID}/products/${PRODUCT_ID}/variants/${VARIANT_ID}/quantity" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/json" \
  -d '{ "quantity": 120 }'

Delete or restore a variant

Action Endpoint SDK method
Delete variant DELETE https://api.selldone.com/shops/{shop_id}/products/{product_id}/variants/{variant_id}/delete window.$backoffice.product.variants.remove(shop_id, product_id, variant_id)
Restore variant POST https://api.selldone.com/shops/{shop_id}/products/{product_id}/variants/{variant_id}/restore window.$backoffice.product.variants.restore(shop_id, product_id, variant_id)

Both return { success, variants, quantity } plus the removed variant_id or the restored product_variant.

Notes

  • Send only the fields you actually want to update; unspecified fields remain unchanged.
  • 422 Unprocessable Entity indicates validation errors (for example a negative price or quantity, or an invalid currency).
  • For enums such as ProductPricing::All or the currency list, see the SDK references below.

SDK and references

Related

Clone this wiki locally