Ad

Can You Setup A Shopify Metafield For All Products In One API Call?

- 1 answer

Is it possible to set a metafield for new products automatically?

For example, can we say for all products, create a metafield which has a constant value X?

From the documentation, it seems like, we would have to do the API call for all products one by one.

Ad

Answer

You are asking several questions so you'll get several answers. For the first one, is it possible to set a metafield for all new products? Yes! You can do it manually when you create the product, or you could theoretically setup a little App script to also do that. Either way, you get a metafield resource attached to a product.

As for can you assign a metafield resource to all your products? Yes! It is a simple API script call, a one-liner actually, that would open each product in your shop, and attach the metafield resource you want to each one. Making an API call per product is easiest as the alternatives are all kind of complex.

Ad
source: stackoverflow.com
Ad