GraphQL mutation productChangeStatus

Topic summary

A user is attempting to use the productChangeStatus GraphQL mutation to archive products but encounters an “Invalid global id” error.

The Problem:

  • The mutation rejects the product ID 2499557997956 despite it existing in the product catalog
  • Error message indicates: “Variable $productId of type ID! was provided invalid value”

The Solution:

  • The productId parameter expects a global ID (GID) format, not a numeric ID
  • Correct format required: gid://shopify/Product/2499557997956

Key Takeaway:
Shopify’s GraphQL API requires IDs to be formatted as global identifiers (GIDs) following the pattern gid://shopify/{ResourceType}/{NumericId} rather than plain numeric values.

Summarized with AI on November 25. AI used: claude-sonnet-4-5-20250929.

I’m using this mutation to try to archive products in bulk. However, I can’t even get it to accept one. What am I doing wrong here? See query and response below. This ID is most definitely in my product catalogue so I’m not sure what it doesn’t like about it.

mutation productChangeStatus($productId: ID!, $status: ProductStatus!) {
  productChangeStatus(productId: $productId, status: $status) {
    product {
      hasOutOfStockVariants
    }
    userErrors {
      field
      message
    }
  }
}
QUERY VARIABLES:

{
  "productId": 6597997559942,
  "status": "ARCHIVED"
}

Response:

{
  "errors": [
    {
      "message": "Variable $productId of type ID! was provided invalid value",
      "locations": [
        {
          "line": 1,
          "column": 30
        }
      ],
      "extensions": {
        "value": 6597997559942,
        "problems": [
          {
            "path": [],
            "explanation": "Invalid global id '6597997559942'",
            "message": "Invalid global id '6597997559942'"
          }
        ]
      }
    }
  ]
}

Hi @Lawson_Thalmann !

The productId is of type ID (or global ID) and so it is expecting the following format:

gid://shopify/Product/6597997559942