How to set option value swatch via productSet mutation?

Topic summary

A user is attempting to set option value swatches (colors/images) programmatically using Shopify’s productSet mutation but has discovered that the OptionValueSetInput type only includes id and name properties—no swatch field.

Key Issue:

  • The mutation’s response object includes swatch data at product > options > optionValues > swatch, suggesting it should be settable via the input
  • The user needs to automate swatch updates for ~10,000 products synced from an external ERP system, making manual UI changes impractical

Workaround Suggested:

  • One commenter proposed using secondary API calls or custom scripts to set swatch attributes after product creation
  • This approach was deemed insufficient for large-scale automation needs

Current Status:

  • The discussion remains unresolved with users requesting Shopify add a swatch property to OptionValueSetInput
  • At minimum, support for hex color values is needed
  • Community members are awaiting official response from Shopify’s API team on whether this functionality will be added
Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

The productSet mutation allows you to set option values via ProductSetInput > productOptions > values. However, values is of type [OptionValueSetInput!], within which OptionValueSetInput only contains id and name properties.

Will you be adding a property swatch to OptionValueSetInput so that we can set a swatch color or image via the productSetMutation? This would be very helpful to be able to being taking advantage of the built-in swatch capabilities.

Alternatively, is there another easy way or mutation to set the swatch property of option values?

1 Like

Hi,

Hope this will help - You can use UI or custom scripts for setting swatches if the API does not support it. This approach typically involves a secondary API call to set swatch attributes based on the product ID created in the productSet mutation.

Thanks for your response. Our catalog has about 10,000 products, so manually using the UI to make these changes simply isn’t viable. It has to be done through automated processes that upload any changes made to our primary catalog data store (in our separate ERP system) directly to the Shopify store.

Given that the response object to the productSet is of type product, which contains the swatch info at product > options > optionValues > swatch, it should be settable via the productSet mutation. Specifically, it should be available in the input object at productSetInput > productOptions > values. Or simply put, a swatch input property should be added to OptionValueSetInput. In our case, we only need to set a hex value, which is as basic as it gets.

1 Like

Any updates from Shopify API team? It’s quite odd that setting/updating swatch is missing from the API.