createOption
View as MarkdownCreate a new option.
mutation
Requires commerce.product:write.
Create a new option.
Non-shareable options require at least one SKU group. Prefer
skuGroupIds. skuGroupId still works but is deprecated. Send type as TEXT, NUMBER, or LIST — not NUMERIC. NUMBER returns NumericOption. min/max live on validation (no step field).For
SimpleMoneyInput.value, send 1999 for $19.99 USD, not 19.99.Required headers
| Header | Required | Description |
|---|---|---|
x-store-id | Yes | ID of the store the operation targets. Omitting it returns HTTP 200 with a GraphQL error: extensions.code: "UNAUTHENTICATED". |
Go to Authentication for credential setup.
Arguments
inputMutationCreateOptionInput!requiredlabelString!requiredtypeString!required — The type of the Option, one ofTEXT,NUMBER,LIST. Option Values are only available on the 'LIST' type.descriptionStringoptionalhtmlDescriptionStringoptionalHTMLDescriptionStringoptional — Deprecated: Use htmlDescription instead.metafields[CreateMetafieldInput!]optionalkeyString!requirednamespaceString!requiredtypeString!required — Metafield value type. Live catalog validation accepts lowercase values such asboolean,string,stringMultiLine,number,numberDecimal,date,dateTime,json,measurement,url,reference,money,list.string,list.number,list.numberDecimal. UppercaseSTRINGis rejected.valueString!required
nameStringoptionalpositionIntoptionalprices[CreateOptionPriceInput!]optionalvalueSimpleMoneyInput!requiredcurrencyCodeString!requiredvalueFloat!required — Integer minor units in the smallest currency unit (for USD, cents:1999= $19.99). Send1999, not19.99.
compareAtValueSimpleMoneyInputoptionalcurrencyCodeString!requiredvalueFloat!required — Integer minor units in the smallest currency unit (for USD, cents:1999= $19.99). Send1999, not19.99.
shareableBooleanoptional — Whether this option is shareable across multiple SKU Groups.skuGroupIdStringoptional — Deprecated: Use skuGroupIds instead.skuGroupIds[String!]optional — The UUIDs of the SKU Groups to associate the Option with.validationCreateOptionValidationInputoptionalmaxIntoptionalminIntoptional
values[CreateOptionValueInput!]optionallabelString!requiredmetafields[CreateMetafieldInput!]optionalkeyString!requirednamespaceString!requiredtypeString!required — Metafield value type. Live catalog validation accepts lowercase values such asboolean,string,stringMultiLine,number,numberDecimal,date,dateTime,json,measurement,url,reference,money,list.string,list.number,list.numberDecimal. UppercaseSTRINGis rejected.valueString!required
nameStringoptionalpositionIntoptionalprices[CreateOptionValuePriceInput!]optionalvalueSimpleMoneyInput!requiredcompareAtValueSimpleMoneyInputoptional
Possible returns
OptionOption
Last updated on
How is this guide?