REST API PUT Request Silently Failing to Update product_category

I am trying to set the product_category for a product using a PUT request via the REST API, but the field is not being updated, even though the API returns a 200 OK success status.

Here are the details of the request:

  • API Endpoint: PUT https://mystore.myshopify.com/admin/api/2024-07/products/{product_id}.json

  • Headers:

    • X-Shopify-Access-Token: (my private token)

    • Content-Type: application/json

      Request Body (JSON):
      {
      “product”: {
      “id”: {product_id},
      “product_category”: {
      “id”: “gid://shopify/ProductCategory/2111”
      }
      }
      }
      Observed Result: The API returns a 200 OK success response, but the product_category field on the product remains null.
      Expected Result: The product’s category should be set to “T-Shirts” (ID 2111).

Anyone have an idea why the API is accepting this request but not applying the product_category update?

Hi, REST is deprecated, you should move over to GraphQL.

Appreciate the reply and that was a good thought. So I tried that too, but it’s still not letting me set the product category. Here are the logs for my attempt…

Aug 31 09:25:59 vibes gunicorn[10588]: [2025-08-31 09:25:59 -0500] [10588] [DEBUG] POST /set_category
Aug 31 09:25:59 vibes gunicorn[10588]: 2025-08-31 09:25:59,162 - INFO - Executing GraphQL mutation with variables: {‘input’: {‘id’: ‘gid://shopify/Product/7937491501126’, ‘categoryId’: ‘gid://shopify/ProductTaxonomyNode/2111’}}
Aug 31 09:25:59 vibes gunicorn[10588]: 2025-08-31 09:25:59,319 - INFO - GraphQL call for product category successful for product 7937491501126.
Aug 31 09:25:59 vibes gunicorn[10586]: [2025-08-31 09:25:59 -0500] [10586] [DEBUG] GET /

So it appears to be successfully setting the category, however the product remains uncategorized in my view.

I’ve been round-and-round on this for hours. I’ve set up a product automation, and this is a critical step before I go listing 3,000 products that I need to upload.

Any help is appreciated.

Hi @MrDoug

I was able to run this mutation in GraphiQL:

mutation SetProductCategory {
  productSet(
    input: {
      id: "gid://shopify/Product/1234567890",
      category: "gid://shopify/TaxonomyCategory/ae" # Can be any valid category GID
    }
  ) {
    productSetOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

Then when I query the products’ category I see this:

I am running into a persistent issue where I am unable to set the Standard Product Category for any products. We have tried multiple documented approaches, as well as the solution listed here, and every attempt fails with an API error, suggesting the feature may be configured differently or is unavailable for our store’s API.

Here is a summary of my attempts:

Attempt 1: Using the productSet Mutation

Based on examples from above, we tried using the productSet GraphQL mutation.

GraphQL Mutation Sent:

GraphQL

mutation productSetCategory($input: ProductSetInput!) {
  productSet(input: $input) {
    product {
      id
    }
    userErrors {
      field
      message
    }
  }
}

Variables Sent:

JSON

{
  "input": {
    "id": "gid://shopify/Product/7972531732550",
    "category": "gid://shopify/ProductTaxonomyNode/2111"
  }
}

JSON Error Received from API: The API rejected this call, stating that the category ID was invalid.

JSON

{
  "errors": [
    {
      "message": "Invalid product_taxonomy_node_id",
      "path": [
        "productSet"
      ],
      "extensions": {
        "code": "INVALID_PRODUCT_TAXONOMY_NODE_ID"
      }
    }
  ]
}

Attempt 2: Searching for the Correct Category ID

To debug the “Invalid ID” error, I then tried to query the API to ask it for the correct category GID for “T-Shirts”.

GraphQL Query Sent:

GraphQL

query {
  productTaxonomyNodes(query: "T-Shirt") {
    edges {
      node {
        id
        name
      }
    }
  }
}

JSON Error Received from API: The API rejected this query, stating that the entire feature doesn’t seem to exist on our query root.

JSON

{
  "errors": [
    {
      "message": "Field 'productTaxonomyNodes' doesn't exist on type 'QueryRoot'",
      "extensions": {
        "code": "undefinedField",
        "typeName": "QueryRoot",
        "fieldName": "productTaxonomyNodes"
      }
    }
  ]
}

My Question

These errors strongly suggest that the Standard Product Category feature is not accessible via the API for my store. Any ideas if I’m missing a function or of there’s an API permission that I’m not seeing? I’ve been round in circles on this a few times now over the last few weesk.