How to create a product with Category linked metafield attributes

Hello guys,

Our team is currently developing a product management software, and while creating products, we want to add category-related attributes. However, we encountered an issue when associating these attributes. We obtained the category list from product-taxonomy/tree, along with the corresponding attribute and attribute value lists and their IDs. The format of the attribute ID is gid://shopify/TaxonomyValue/2878.

However, in the ProductCreate API, the linkedMetafield field requires the ID to be in the format: “gid://shopify/Metaobject/971662527”.

Could you please advise on how I can obtain the correct category attribute ID?

Hi, there

Recommend using this link.

Hi Eric,

Thanks for replying. I have already obtained the category values and keys, as well as the corresponding attribute values and keys from this link. However, the format of the key is different from what is required by the ProductCreate API. Do you know how to convert the “id: gid://shopify/TaxonomyValue/2878” to the format “gid://shopify/Metaobject”?

Regards,
Rick

HI, Rickup

Have you ever build up your Metaobject in advance?

This could be done using API or manually in dashboard?

BTW , i dont understand why you wanna make aconvertion.

When I select a category, Shopify recommends some metafields. These metafields were not created by me; they are provided by Shopify. I want to post those Shopify-recommended metafields.