Skip to Content

CustomField

Represents a product’s custom field, including its value, type, and handle.

Type Definition

type CustomField { title: String handle: String value: String type: String }

Fields

FieldTypeNullableDescriptionRelationships
titleStringYesThe display title of the custom field.None
handleStringYesThe unique handle for the custom field.None
valueStringYesThe value assigned to the custom field.None
typeStringYesThe type of the custom field (e.g., text, number).None

Relationships

The CustomField type does not have direct relationships to other object types. It is typically used as a nested object within other types, such as products, to represent additional structured metadata.

Usage Examples

Basic Query

{ customField { title handle value type } }

Field Selection

{ customField { title value } }

Nested Queries

{ product(id: 12345) { id name customField { handle value type } } }

Filtering and Sorting

The CustomField type itself does not support direct filtering or sorting. Filtering and sorting should be applied on the parent object that contains CustomField. For example, filtering products by a custom field value would be done at the product query level.

{ products(filter: { customFieldHandle: "color", customFieldValue: "red" }, sort: { field: "name", direction: ASC }) { edges { node { id name customField { handle value } } } } }

(Note: Adjust filtering and sorting syntax based on the parent type’s capabilities.)

Implements

The CustomField type does not implement any interfaces.

Connections

CustomField does not have connection fields or pagination as it is a simple object type.

  • Product (commonly contains CustomField objects to represent additional metadata)

Best Practices

  • Use the handle field as a stable identifier for referencing custom fields programmatically.
  • Use the type field to understand how to interpret the value (e.g., parse as number if type is “number”).
  • When querying nested CustomField objects, select only the fields you need to optimize query performance.
  • Since all fields are optional, always check for null values in your client code to avoid runtime errors.

Notes

  • All fields in CustomField are optional and may return null if not set.
  • This type is designed for flexible metadata storage and does not enforce strict validation on value based on type.
  • The API currently requires no authentication, but this may change in future versions. Plan your integration accordingly.
  • Avoid over-fetching by selecting only necessary fields to improve response times and reduce payload size.
Last updated on