Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Why is productCategory returning NULL in my GraphQL code?

Solved

Why is productCategory returning NULL in my GraphQL code?

chen4eto
Shopify Partner
2 1 0

Hello, I am trying to create a product with GraphQL and my code for productCategory is that:  

$variables['productCategory'] =  array([
                "productTaxonomyNodeId" =>"2879"
            ]);
 
I give the TaxionmyId but when the product is created and I get the product data,  productCategory returns NULL.
I can't find where is the problem with my code. I get the id from 
https://help.shopify.com/txt/product_taxonomy/en.txt?shpxid=2761127d-AEE3-4A5E-478F-4B6E19271E85Is it possible that I have to submit some other id?
Accepted Solution (1)

chen4eto
Shopify Partner
2 1 0

This is an accepted solution.

I find what is the problem:

First, I don't provide productCategory in the input array, and secondly, I need to add the 'productTaxonomyNodeId' global id, which looks like this gid://shopify/ProductTaxonomyNode/ 2879

View solution in original post

Reply 1 (1)

chen4eto
Shopify Partner
2 1 0

This is an accepted solution.

I find what is the problem:

First, I don't provide productCategory in the input array, and secondly, I need to add the 'productTaxonomyNodeId' global id, which looks like this gid://shopify/ProductTaxonomyNode/ 2879