Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Hello,
I was wondering what is the best method to gather metafields from products in bulk? It seems to be that the only way is to use a product ID then gather it's metafields. I'm wondering if there's a way to perhaps provide multiple IDs or to gather a group of products with their metafields.
Any help would be appreciated, thank you!
HI @ruffgenius
Have you tried using a collection to group the products instead? Then you can use the code below as reference to call the metafield. Used the collection handle "my-collection" in this example.
{% for product in collections['my-collection'].products %}
{{ product.metafields.my_fields.instructions }}
{% endfor %}
Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
@ruffgenius wrote:I was wondering what is the best method to gather metafields from products in bulk?
Collections are the best way if just trying to spit product info out in a theme.
Otherwise use the bulk editor in the admin if just needing to view the data.
Make sure this isn't an XY problem ,what are trying to do.
What do you mean by "gather". What happens after they are gathered.
What is the actual goal.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org