JavaScript SDK
Product update
Product Update Guide
When updating product information through the API, especially when dealing with variants, there are specific rules that must be followed to ensure successful updates.
Key Rules for Variant Updates
- Maintain Original Order: The variants array must maintain the exact same order as received from Shopify
- Complete Array Required: You must provide the entire variants array, even when updating a single variant
- Position Matters: Each variant must remain in its original position in the array
Allowed Fields
Product Fields
You can only update these fields for products:
id
description_html
(ordescriptionHtml
for backward compatibility)variants
price
compare_at_price
title
Variant Fields
You can only update these fields for variants:
id
price
compare_at_price
title
Examples
❌ Incorrect Approach
This will not work - sending only the variant you want to update:
✅ Correct Approach
Do this - send all variants in their original order:
Important Notes
- Variant Order: Must exactly match what you received from Shopify
- All Variants Required: Include all variants in the array, even ones you’re not updating
- Minimal Updates: For unchanged variants, you only need to include their
id
- Field Validation: Including fields not listed in the allowed fields will cause the update to fail
Best Practice Example
Here’s a complete example showing how to properly update a variant: