Skip to main content

validateSKU

Requires at least one of the permissions products:product:create or products:product:update.

Tells whether a SKU is free to use: true when no active variant of the organization has it. Needs the products create or update permission.

Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.

Example:

query ValidateSKU($sku: String!) {
validateSKU(sku: $sku)
}

Variables:

{
"sku": "string"
}

Response:

{
"data": {
"validateSKU": true
}
}
validateSKU(
excludeProductId: ID
sku: String!
): Boolean!

Arguments​

validateSKU.excludeProductId ● ID scalar​

The ID of a variant to leave out of the check, so a record's own SKU is not reported as taken.

validateSKU.sku ● String! non-null scalar​

The SKU to check.

Type​

Boolean scalar​

The Boolean scalar type represents true or false.