Skip to Content

CustomizationGroupOptionInput

Input for adding merchandise lines with customizations to the cart.

Input Definition

input CustomizationGroupOptionInput { id: String! value: String! }

Fields

FieldTypeRequiredDescriptionDefault Value
idStringYesThe unique identifier for the customization group option.None
valueStringYesThe value of the customization option selected by the user. This is used only for text-based options.None

Usage Examples

Basic Usage

mutation { addCustomizationOption(input: { id: "engraving-text" value: "Happy Birthday, John!" }) { success message } }

Complex Input

mutation { addCustomizationOption(input: { id: "gift-message" value: "Please wrap this gift with red paper and include a card." }) { success message } }

With Variables

mutation AddCustomizationOption($input: CustomizationGroupOptionInput!) { addCustomizationOption(input: $input) { success message } }

Variables:

{ "input": { "id": "custom-note", "value": "Leave package at the back door." } }

Nested Objects

The CustomizationGroupOptionInput is a flat input type and does not contain nested input objects.

Validation Rules

  • id: Must be a non-empty string matching the unique identifier of an existing customization group option.
    Example: "engraving-text"
    Invalid Example: "" (empty string) or a non-existent ID will cause validation errors.

  • value: Must be a non-empty string representing the user’s selected text for the customization option. This field is mandatory for text-based customization options.
    Example: "Happy Birthday!"
    Invalid Example: "" (empty string) will result in a validation error.

Error Examples

  • Missing required field id:
{ "errors": [ { "message": "Field 'id' of required type 'String!' was not provided.", "locations": [{ "line": 2, "column": 5 }] } ] }
  • Missing required field value:
{ "errors": [ { "message": "Field 'value' of required type 'String!' was not provided.", "locations": [{ "line": 3, "column": 5 }] } ] }
  • Empty string for id or value:
{ "errors": [ { "message": "Validation error: 'id' and 'value' must be non-empty strings.", "locations": [{ "line": 2, "column": 5 }] } ] }

Best Practices

  • Always provide both id and value fields as non-empty strings to avoid validation errors.
  • Use meaningful and user-friendly text for the value field to ensure clarity in customization.
  • Validate the id against the list of supported customization group options before sending the mutation.
  • Use GraphQL variables to improve readability and reusability of your mutations.
  • Since this input type is designed for text-based customization options, do not use it for non-text customizations.
  • Handle errors gracefully by checking for validation messages and prompting users to correct input.
  • This input type is typically used in mutations that add or update merchandise lines with customizations in the cart.
  • It may be nested within other input types that represent merchandise lines or cart updates.

Notes

  • The API currently requires no authentication, but this may change in future versions.
  • Always check the latest API schema for updates to input types and their fields.
  • This input type does not support nested inputs; all fields are scalar strings.
  • Ensure that the id corresponds exactly to a valid customization group option to avoid errors.
Last updated on