I’m developing an app and to be efficient and reduce the amount of data pulled from my servers (better for page load speeds etc) I’d like to store some data in the metafields.
Those are quite cool but what if a shop has, say 50k products? If I use the API I will have to wait for my installation process to run multiple days! Is there any way to create those metafields in bulk? Or any other efficient way? I can’t find anything in the API description.
We don’t currently have a createMetafield mutation on our GraphQL admin API but that might be something to look for in the future as well, the whole idea behind our GQL api is to reduce request count so I wouldn’t be surprised if that made things a bit easier too.
My mistake! I got confused because the way we handle it is a bit more different from the RESTful approach than I thought. You can add metafields through the product object directly rather than creating the metafield on its own:
We just don’t have a mutation to create a metafield externally. As long as you do it through the product you should be good. It’s worth noting you can also perform multiple mutations in one request as well as long as you’re within the complexity limit.
related question. Can we create/update metafields on the shop level through the GraphQL Admin API yet? I see there is a “metafieldDelete” mutation bur I cannot find something along the lines of “shopUpdate” that woul let me do updates of shop metafields analog to “productUpdate”.