Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

productCreate mutation only registers one productOption value, despite multiple being sent

Solved

productCreate mutation only registers one productOption value, despite multiple being sent

daveluke
Shopify Partner
25 2 10

Sending the following input:

 

{"bodyHtml":"body","title":"Title","tags":"","productOptions":[{"name":"Length","position":1,"values":[{"name":"12\"\/14\"\/16\" bundle deal"},{"name":"14\"\/16\"\/18\" bundle deal"},{"name":"16\"\/18\"\/20\" bundle deal"},{"name":"18\"\/20\"\/22\" bundle deal"},{"name":"20\"\/22\"\/24\" bundle deal"},{"name":"22\"\/24\"\/26\" bundle deal"}]}]}

 

Getting the following response. Note that only one value registered

{"data":{"productCreate":{"product":{"id":"gid://shopify/Product/7379926188141","options":[{"id":"gid://shopify/ProductOption/9449329688685","name":"Length","values":["12\"/14\"/16\" bundle deal"]}]},"userErrors":[]}},"extensions":{"cost":{"requestedQueryCost":11,"actualQueryCost":11,"throttleStatus":{"maximumAvailable":2000.0,"currentlyAvailable":1989,"restoreRate":100.0}}}} 

Accepted Solution (1)

daveluke
Shopify Partner
25 2 10

This is an accepted solution.

Figured it out. The values are registering. The sole option value in the "values" array is there, because of the single variant automatically created. To get the rest of the values, query product.options.optionValues in the response:

 

product {
id
options {
id
name
values
optionValues {
id
name
hasVariants
}
}

}

View solution in original post

Reply 1 (1)

daveluke
Shopify Partner
25 2 10

This is an accepted solution.

Figured it out. The values are registering. The sole option value in the "values" array is there, because of the single variant automatically created. To get the rest of the values, query product.options.optionValues in the response:

 

product {
id
options {
id
name
values
optionValues {
id
name
hasVariants
}
}

}