Automatic update of taxonomy category

Hello,

I’m trying to find a way to automatically assign a taxonomy category when a new product is created via Send API request & product upate.

So far I tried the App Flow, but somehow I only got it to work for the old values and not for the new ones.

Am I missing something or is there anything else I can use?

I want to use Tshirt:

gid://shopify/TaxonomyCategory/aa-1-13-8

Is there any way to do this automated either in Flow or somewhere else?

This works in Flow for the old values:

{
"input": {
  "id": "gid://shopify/Product/8606116380921",
   "productCategory": {
     "productTaxonomyNodeId": "gid://shopify/ProductTaxonomyNode/174"
}
}
}

Tried this but did not work:

{
"input": {
  "id": "gid://shopify/Product/8606116380921",
   "productCategory": {
      "category": "gid://shopify/TaxonomyCategory/aa-1-13-8"
}
}
}

It sounds like you’re on the right track with using Shopify Flow to automate taxonomy assignments! Since the old values work but the new ones don’t, it might be an issue with how the new values are being referenced or formatted.

Here’s a suggestion: Ensure that the new taxonomy category IDs (gid://shopify/TaxonomyCategory/aa-1-13-8) are correctly referenced in your Flow. You might need to verify that these IDs are valid and exist in your Shopify store.

If the issue persists, you could try using the Shopify GraphQL API to set the product category programmatically. This approach might give you more control and flexibility over the assignment process.

Regards,

Monica

Hello,

thank you very much for the quick answer.

I’m pretty new to this and don’t exactly know what you mean with the last part.

I have 108 Products which are using this new Taxonomy Category already.

I use Printify to create new Products which will automatically be synced into Shopify. I want to directly update the Taxonomy Category every time a new products gets added.

  1. What would be the steps to use Shopify GraphQL API to set the product category programmatically?

Hello, I have the same problem. Have you found a solution since then?

Are you doing a productUpdate mutation?

Assuming “yes”, the category structure changes in the 2024-07 API version and Flow currently uses 2024-04. We are close to adopting 2024-07, which will enable this. If you can’t wait, you could try Send HTTP request instead and use whatever API version you want.

I’m trying outside of Flow on my end. Here is my code:

const taxonomyId = "gid://shopify/TaxonomyCategory/sg-4-4-3-13";
const productResponse = await fetch(`https://${shopName}.myshopify.com/admin/api/2024-07/products/${id_shopify}.json`, {
    method: "PUT",
    headers: {
        "Content-Type": "application/json",
        "X-Shopify-Access-Token": accessToken
    },
    body: JSON.stringify({
        product: {
            id: id_shopify,
            productCategory: {
                productTaxonomyNode : {
                    id: taxonomyId
                }
            }
            
        }
    })
});