Writing taxonomy attributes to variants

Writing taxonomy attributes to variants

dsoprea
Shopify Partner
12 0 4

Using GraphiQL (Shopify app), it seems intuitive enough to connect from products -> variants -> metafields -> references -> metaobjects -> values, however it is totally unclear how to set taxonomy attributes on anything. There appears to be no way of setting metaobjects on either products or variants, and the only obvious metaobject mutations appear to write metaobjects directly and in a vacuum. It's not clear how to associate them with specific owners/things.

 

Setting a taxonomy category on a product is stupidly obvious. Can someone share an example of how to write an attribute value? It looks like you can attach a particular attribute type to products (using the plus icon on the list of supported, standard attributes in the UI or probably using the "standardMetaobjectDefinitionEnable" mutation in the API) and, when queried, the product will show that the metafield definition has been attached to that product. I'm assuming that it's a matter of maybe finding a mutation performed against (on the connection of) the definition in the context of the owner, except that the GraphQL API doesn't even seem to have variant-level mutations. That seems wrong, though I've verified that I have write on products, metafields, and metaobjects, and it just isn't there.

 

There are `TaxonomyAttribute` and `TaxonomyValue` objects, which seemed like a guaranteed way of finding the mutations, though they only seem to be involved in GraphQL unions. Is this just not available in the public API?

 

I'm using API version 2025-01 from development as well as from GraphiQL.

 

As a side note, it seems like taxonomy attributes depend on metaobjects and metaobjects can be assigned to a variety of different types of owners/things, but I've still seen no documentation or examples of writing taxonomy attributes or metaobjects on variants via the API. The only thing remotely related I've experienced is being able to assign a set of attributes at the product level via the UI. I'm really not sure how those are supposed to be used from that point. I'm just logically assuming that, at some point, attributes would have to be written on actual variants in order for them to have any use at all.

 

Thank you.

Replies 0 (0)