How to get related products to show only products from the same collection

Is there a way to have the related products section on the bottom of a product page show only products from the same collection? I know there is the search and discovery app but I have many products and want to have this happen automatically. For example: I sort all of my products by US state (New York, Florida, Nebraska, etc) so visitors will tend to get to a product by picking which state they want first. Let’s use New York as an example. How do I get the related products at the bottom of the page of a New York item to show only other New York items?

Hi @terzdesign ,

May I suggest to update code these steps:

  1. Go to Store Online-> theme → edit code
  2. Add section/related-by-collection.liquid file

  1. Get code here https://github.com/eboost10/2640367/blob/main/2948119/sections/related-by-collection.liquid

  2. Paste code that you get from step 3 to the file that you created at step 2

  3. Go to customize theme → product → add Related by collection section

Thanks for the reply. I did those steps. Each product is showing the same related products now. Your solution doesn’t seem to pull from the same state collection as product that is on the page. Is there a way to get it to do that?

Have you found the solution yet since I am sharing the same issue like you. Curious about a really effective solution for this case.

Hi @terzdesign

You can create separate product templates for products on each collection, then add Featured collection instead of Related collection so you can select collection.

Hi. It seems you are trying to use meta objects to feature products in a ‘featured collection’ section. I use tags to automatically add a product to its correct state. For example, I add the tag ‘New York’ if I want it to be a part of the New York Collection. Can I use that same tag to draw the products into this ‘featured collection’ section?

Not yet.

Hi @terzdesign ,

If you want to show products by tag. Maybe I suggest you code below

  1. section/related-by-collection.liquid → update new code here https://github.com/eboost10/2640367/blob/main/2948119/sections/related-by-collection.liquid

  2. create a templates/collection.tags.liquid file → you can get code here https://github.com/eboost10/2640367/blob/main/2948119/templates/collection.tags.liquid

  1. Add tag for each product

Ex: related:New York

Hello @terzdesign ,

Any code that you can add at the template level will only allow you to show random products from the same collection. It’s not ideal and can give unexpected results when products are part of several different collections.

It is not possible to take Shopify’s product recommendations and filter them to the matching collection, and as you pointed out the Search & Discovery app will only allow you to edit thigns manually.

For an entirely automated approach you’ll have to install a dedicated related products app.

any app suggestions? preferably free

Our app does what you’re looking for, it is not free but it has a free trial, and discounted plans for newly launched or low-traffic stores.

You can check it out here: https://apps.shopify.com/recomatic.