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.