Liquid: How to add a product to a collection/tag using Liquid code?

Highlighted
Tourist
14 0 1

Hey Shopify community.

So I'm looking for a way I can use the data in the metafields of my products to automatically add all current and future products I make to different collections. I believe I got the Liquid logic know how to pull the desired metafield info from every product, but what I feel like I'm missing is the step of being able to add any product to a collection via Liquid logic.


Does anyone know what the Liquid/JS solution would look like for a command that adds a product to a collection?

 

Another potential solution to this would be to add a tag to each product using liquid logic code, since I can make the collection setting automatically add any product with a certain tag.

 

- Nick

0 Likes
Tourist
14 0 1

Don't think this is relevant but I'm using Supply.

Again just need a way to add to a collection or a product tag or to a collection using Liquid logic.

0 Likes
Highlighted
Shopify Expert
2686 67 688

Nick,

you can't change your products or collection(s) from your theme, otherwise anyone would be able to make your products free and order heaps of them :)

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
Tourist
14 0 1

Hey Tim,


Hmm perhaps I can ask this question a little more holistically. What I am looking to do is make a collection in Shopify that is based on the value of a product's metafield variable. Is this possible?

0 Likes
Highlighted
Shopify Expert
2686 67 688

Nope.

You'd need an app for this.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes