Skip to main content
PATCH
/
api
/
v3
/
admin
/
products
/
{product_id}
/
variants
/
{id}
Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'

const client = createAdminClient({
  baseUrl: 'https://your-store.com',
  secretKey: 'sk_xxx',
})

const variant = await client.products.variants.update('prod_86Rf07xd4z', 'variant_k5nR8xLq', {
  sku: 'UPDATED-SKU',
  stock_items: [
    { stock_location_id: 'sloc_UkLWZg9DAJ', count_on_hand: 75 },
  ],
})
{
  "id": "variant_gbHJdmfrXB",
  "product_id": "prod_UkLWZg9DAJ",
  "sku": "UPDATED-SKU",
  "options_text": "Size: S",
  "track_inventory": true,
  "media_count": 0,
  "thumbnail_url": null,
  "purchasable": true,
  "in_stock": false,
  "backorderable": true,
  "weight": 103.11,
  "height": 18.21,
  "width": 34.43,
  "depth": 192.11,
  "price": {
    "id": "price_gbHJdmfrXB",
    "amount": "19.99",
    "amount_in_cents": 1999,
    "compare_at_amount": null,
    "compare_at_amount_in_cents": null,
    "currency": "USD",
    "display_amount": "$19.99",
    "display_compare_at_amount": null,
    "price_list_id": null
  },
  "original_price": null,
  "option_values": [
    {
      "id": "optval_UkLWZg9DAJ",
      "option_type_id": "opt_UkLWZg9DAJ",
      "name": "size-12",
      "label": "S",
      "position": 1,
      "color_code": null,
      "option_type_name": "foo-size-21",
      "option_type_label": "Size",
      "image_url": null,
      "metadata": {},
      "created_at": "2026-05-21T18:11:50.606Z",
      "updated_at": "2026-05-21T18:11:50.606Z"
    }
  ],
  "metadata": {},
  "position": 2,
  "cost_price": "17.0",
  "cost_currency": "USD",
  "barcode": null,
  "weight_unit": "lb",
  "dimensions_unit": null,
  "deleted_at": null,
  "created_at": "2026-05-21T18:11:50.603Z",
  "updated_at": "2026-05-21T18:11:50.909Z",
  "tax_category_id": "taxcat_UkLWZg9DAJ",
  "available_stock": 0,
  "reserved_quantity": 0,
  "total_on_hand": 0,
  "product_name": "Product 555738"
}

Documentation Index

Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-spree-api-key
string
header
required

Secret API key for admin access

Authorization
string
header
required

JWT token for admin user authentication

Headers

x-spree-api-key
string
required
Authorization
string
required

Bearer token for admin authentication

Path Parameters

product_id
string
required

Product ID

id
string
required

Variant ID

Body

application/json
sku
string
Example:

"SKU-001"

price
number
Example:

29.99

compare_at_price
number
Example:

39.99

cost_price
number
Example:

10

cost_currency
string
Example:

"USD"

weight
number
height
number
width
number
depth
number
weight_unit
string
dimensions_unit
string
track_inventory
boolean
tax_category_id
string
options
object[]
total_on_hand
integer
Example:

100

position
integer
barcode
string
prices
object[]
stock_items
object[]

Response

200 - application/json

variant updated