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:
- GraphQL
- cURL
query ValidateSKU($sku: String!) {
validateSKU(sku: $sku)
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query ValidateSKU($sku: String!) {\n validateSKU(sku: $sku)\n}",
"variables": {
"sku": "string"
}
}
EOF
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.