Support

createOption

View as Markdown

Create 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

HeaderRequiredDescription
x-store-idYesID 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

  • input MutationCreateOptionInput! required
    • label String! required
    • type String! required — The type of the Option, one of TEXT, NUMBER, LIST. Option Values are only available on the 'LIST' type.
    • description String optional
    • htmlDescription String optional
    • HTMLDescription String optional — Deprecated: Use htmlDescription instead.
    • metafields [CreateMetafieldInput!] optional
      • key String! required
      • namespace String! required
      • type String! required — Metafield value type. Live catalog validation accepts lowercase values such as boolean, string, stringMultiLine, number, numberDecimal, date, dateTime, json, measurement, url, reference, money, list.string, list.number, list.numberDecimal. Uppercase STRING is rejected.
      • value String! required
    • name String optional
    • position Int optional
    • prices [CreateOptionPriceInput!] optional
      • value SimpleMoneyInput! required
        • currencyCode String! required
        • value Float! required — Integer minor units in the smallest currency unit (for USD, cents: 1999 = $19.99). Send 1999, not 19.99.
      • compareAtValue SimpleMoneyInput optional
        • currencyCode String! required
        • value Float! required — Integer minor units in the smallest currency unit (for USD, cents: 1999 = $19.99). Send 1999, not 19.99.
    • shareable Boolean optional — Whether this option is shareable across multiple SKU Groups.
    • skuGroupId String optional — Deprecated: Use skuGroupIds instead.
    • skuGroupIds [String!] optional — The UUIDs of the SKU Groups to associate the Option with.
    • validation CreateOptionValidationInput optional
      • max Int optional
      • min Int optional
    • values [CreateOptionValueInput!] optional
      • label String! required
      • metafields [CreateMetafieldInput!] optional
        • key String! required
        • namespace String! required
        • type String! required — Metafield value type. Live catalog validation accepts lowercase values such as boolean, string, stringMultiLine, number, numberDecimal, date, dateTime, json, measurement, url, reference, money, list.string, list.number, list.numberDecimal. Uppercase STRING is rejected.
        • value String! required
      • name String optional
      • position Int optional
      • prices [CreateOptionValuePriceInput!] optional
        • value SimpleMoneyInput! required
        • compareAtValue SimpleMoneyInput optional

Possible returns

  • Option Option

Last updated on

How is this guide?