product Option Update
Requires access scope. Also: The user must have a permission to edit products and manage product variants.
Updates an option on a product, such as size, color, or material. Each option includes a name, position, and a list of values. The combination of a product option and value creates a product variant.
Use the mutation for the following use cases:
- Update product choices: Modify an existing option, like "Size" (Small, Medium, Large) or "Color" (Red, Blue, Green), so customers can select their preferred variant.
- Enable personalization features: Update an option (for example, "Engraving text") to let customers customize their purchase.
- Offer seasonal or limited edition products: Update a value (for example, "Holiday red") on an existing option to support limited-time or seasonal variants.
- Integrate with apps that manage product configuration: Allow third-party apps to update options, like "Bundle size", when customers select or customize product bundles.
- Link options to metafields: Associate a product option with a custom metafield, like "Fabric code", for richer integrations with other systems or apps.
The mutation enforces strict data integrity for product options and variants.
All option positions must be sequential, and every option should be used by at least one variant.
After you update a product option, you can further manage a product's configuration using related mutations:
Learn more about the product model and adding product data.
Arguments
- Anchor to optionoption•Option
Update Input! required Option to update.
- Anchor to optionValuesToAddoption•[Option
Values To Add Value Create Input!] New option values to create.
- Anchor to optionValuesToDeleteoption•[ID!]
Values To Delete IDs of the existing option values to delete.
- Anchor to optionValuesToUpdateoption•[Option
Values To Update Value Update Input!] Existing option values to update.
- Anchor to productIdproduct•ID!
Id required The ID of the Product the Option belongs to.
- Anchor to variantStrategyvariant•Product
Strategy Option Update Variant Strategy The strategy defines which behavior the mutation should observe regarding variants, such as creating variants or deleting them in response to option values to add or to delete. If not provided or set to null, the strategy
will be used.
- Anchor to productproduct•Product
The product with which the option being updated is associated.
- Anchor to userErrorsuser•[Product
Errors Option Update User Error!]! non-null The list of errors that occurred from executing the mutation.