
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYou're absolutely right to be concerned about this! The current implementation in Sanity Connect for Shopify does have this limitation, and your example perfectly illustrates the problem.
Looking at the reference documentation, product options in Sanity Connect are structured as simple string arrays:
"options": [
{
"_key": "Color",
"_type": "option",
"name": "Color",
"values": ["Blue", "Ecru", "Pink"]
}
]The issue is that when you have multiple options with the same value names (like "Signed" and "Unsigned" appearing in both "Blue" and "Red" options), there's no unique identifier to distinguish them when you need to map them to specific variants.
The way to handle this currently is to use the variant documents themselves, which do contain the necessary information. Each variant document includes:
option1, option2, option3 fields with the actual option valuesid and gid (Shopify's global ID)productIdWhen querying variants with Shopify's Storefront API using variantBySelectedOptions, you'd need to:
option1, option2, option3 fieldsThis is indeed brittle, as you mentioned, because it relies on positional matching.
For your use case, you should consider implementing a custom sync handler. Custom sync handlers let you transform the data before it's saved to Sanity, so you could restructure the options to include variant IDs or create a more robust mapping structure.
With a custom handler, you could transform the data to something like your desired structure, or create a lookup table that maps option combinations to variant IDs directly on the product document.
The custom webhook payload includes ProductVariant objects with selectedOptions that show the name-value pairs, which you could use to build a more explicit mapping during sync.
This is definitely a valid pain point with the default sync structure, and using custom sync handlers is the recommended approach when the out-of-the-box schema doesn't quite fit your needs!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store