What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Gathering Metafields

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
9159 2184 2700

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!

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.
Create custom Shopify pages effortlessly with PageFly's drag-and-drop ⚙️.

PaulNewton
Shopify Partner
7481 658 1566

@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