Product Options Reorder User Error
Requires access scope.
Error codes for failed mutation.
Anchor to FieldsFields
- Anchor to codecode•Product
Options Reorder User Error Code The error code.
- Anchor to fieldfield•[String!]
The path to the input field that caused the error.
- Anchor to messagemessage•String!non-null
The error message.
Anchor to MutationsMutations
- •mutation
Reorders the options and option values on a product, updating the order in which product variants are presented to customers.
The
mutation accepts a list of product options, each identified by
id
orname
, and an optional list of values (also byid
orname
) specifying the new order. The order of options in the mutation's input determines their new positions (for example, the first option becomesoption1
). The order of values within each option determines their new positions. The mutation recalculates the order of variants based on the new option and value order.Suppose a product has the following variants:
"Red / Small"
"Green / Medium"
"Blue / Small"
You reorder options and values:
options: [ { name: "Size", values: [{ name: "Small" }, { name: "Medium" }] }, { name: "Color", values: [{ name: "Green" }, { name: "Red" }, { name: "Blue" }] } ]
The resulting variant order will be:
"Small / Green"
"Small / Red"
"Small / Blue"
"Medium / Green"
Use the
mutation for the following use cases:
- Change the order of product options: For example, display "Color" before "Size" in a store.
- Reorder option values within an option: For example, show "Red" before "Blue" in a color picker.
- Control the order of product variants: The order of options and their values determines the sequence in which variants are listed and selected.
- Highlight best-selling options: Present the most popular or relevant options and values first.
- Promote merchandising strategies: Highlight seasonal colors, limited editions, or featured sizes.
NoteThe
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 reorder product options, you can further manage a product's configuration using related mutations:
Learn more about the product model and managing product data.
- Anchor to optionsoptions•[Option
Reorder Input!]! required Options to reorder on the product.
- Anchor to productIdproduct•ID!
Id required The ID of the product to update.
Arguments
- Anchor to productproduct•Product
The updated product object.
- Anchor to userErrorsuser•[Product
Errors Options Reorder User Error!]! non-null The list of errors that occurred from executing the mutation.
Fields