Gathering Metafields

ruffgenius
Visitor
1 0 1

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!

Replies 2 (2)

Made4uo-Ribe
Shopify Partner
6117 1468 1812

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!

Please don't forget to 

Like

 and 

Mark Solution 

to the post that helped you. Thanks!
Sip, savor, and support – your

Coffee Tip

 helps us keep coding magic.❤️❤️❤️
For FREE, premium codes, and trusted, knowledgeable Shopify developers, visit us at

Made4uo.com


PaulNewton
Shopify Partner
6339 579 1348

@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.

 

 

 

 

 

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org