Skip to Content

Locale

Describes a locale.

Type Definition

type Locale { endonymName: String isoCode: String name: String primary: Boolean rootUrl: String }

Fields

FieldTypeNullableDescriptionRelated Types
endonymNameStringYesReturns the endonym name for this locale.None
isoCodeStringYesReturns the ISO code for this locale.None
nameStringYesReturns the name of the locale.None
primaryBooleanYesReturns true if this locale is the shop’s primary locale.None
rootUrlStringYesReturns the root URL for this locale.None

Relationships

  • The Locale type is used by the Customer object through the language field, indicating the preferred language or locale of a customer.

Usage Examples

Basic Query

query { locale { endonymName isoCode name primary rootUrl } }

Field Selection

query { locale { name isoCode } }

Nested Queries

query { customer(id: 12345) { id language { name isoCode primary } } }

Filtering and Sorting

The Locale object itself does not support filtering or sorting directly as it is typically returned as part of other queries (e.g., customer language). Filtering and sorting should be applied on the parent objects that reference Locale.

Implements

This type does not implement any interfaces.

Connections

No connection fields are defined on the Locale type.

  • Customer
    The language field on the Customer object returns a Locale object representing the customer’s preferred locale.

Best Practices

  • Always check for nullability on optional fields such as endonymName, isoCode, and rootUrl as they may not be present for all locales.
  • Use the primary field to determine if the locale is the shop’s default locale, which can help in fallback logic for localization.
  • When querying customer data, include the language field to tailor content and communications according to the customer’s locale preferences.

Notes

  • The Locale type fields are optional and may return null if the data is not set or applicable.
  • This API currently requires no authentication, but this may change in future versions.
  • Since Locale is a lightweight object, querying it has minimal performance impact.
  • There are no computed or derived fields on this type.
  • No field arguments are defined for the Locale type fields.
Last updated on