How can I display all product reviews by product type on each product page?

Hi all

I’m setting up a new store using the Kingdom Theme, and hoping to get some help with the display of product reviews.

Basically I’m hoping to find a way to display all the reviews matching the product.type (not product.id) on each product page.

This is because products of the same product.type are all bags of the same size though different colours.

Setting the colours up as product options/variants won’t work as I’ll have far more than the 100 allowed combinations (amongst other reasons).

If there a simple way to modify the code to allow this?

Cheers

Matt

Have you considered metafields or tags to set up the links? In a lot of our stores, we’re in control of the data input via loaders.

I would do something like this: Add a tag like this which contains a key and values (separated by ||) “Related Prods:123456||111111||222222”

Then a quick liquid block to get the related ids from the tag:

{%- liquid
  assign related_ids = nil
  for tag in product.tags
     assign prefixed_tag = tag | split: '_'
        if prefixed_tag.size == 2
            assign tag_key = tag | split: '_'| first | downcase
            if tag_key == 'Related Prods:'
               assign related_ids_values = tag | split: '_' | last
               assign related_ids = related_ids_values | split: '||' 
            endif
        endif
    endfor
-%}

Problem is that it’s painful setting up the data… :disappointed_face:

Do you have any hooks to set up the data on the prods? e.g. via a loader?

Hi Tim

This sounds like an elegant solution, though to clarify am I adding the tags to the products that reference the reviews or do the tags reference the other products to share the reviews with?

I think I might try for a purely liquid approach using the articles as I can then also create a reviews page sorted by category (like I’ve done here - www.mattt.com.au/feedback) which would be tricky using the reviews themselves.

Cheers

Matt