Api request to update product category

I inspected all apis made available by shopify and could not find any that exposes product category. would like to send the taxonomy from my erp to shopify

E.g. for a product of type = hats i want to set programmatically via a put or patch request the category to gid://shopify/TaxonomyCategory/aa-2-17.

Is this supported today? which API?

Odd. Were you not able to able to use this? Product { category }

It’s the product mutation so I’m sure that’s it.

@Silviu_Virlan, you can use productSet mutation.

2 Likes

Hey @Silviu_Virlan! Remy is spot on here - the category field on productSet is what you need, and the GID format you already have (gid://shopify/TaxonomyCategory/aa-2-17) is correct.

Here’s an example:

mutation {
  productSet(
    input: {
      category: "gid://shopify/TaxonomyCategory/aa-2-17"
    },
    identifier: {
      id: "gid://shopify/Product/YOUR_PRODUCT_ID"
    }
  ) {
    product {
      id
      category {
        id
        name
      }
    }
    userErrors {
      field
      message
    }
  }
}
1 Like

@Donal-Shopify Why would you use productSet for this instead of productUpdate?