Related products

Shopify Partner
49 0 1

Hi, I'm having trouble with my related products on my products page.

Most of my products belong to numerous collections and I want to be able to control the collection that is shown in the related products. I would like to show one collection in particular and I thought I could do it by alphabetizing the collections since I seem to remember that that used to work. Now if doesn't. So now I'd like to give an if statement that includes a max number of products. This is the part in the code that I want to change to reflect this limit in the collection:

<!-- Begin related product -->
  {% if settings.show_related_products %}
    {% if collection and collection.products.size > 1 %}

but instead I want to do something like this where the amount of products in the collection are between 1 and 20:
{% if collection and collection.products.size > 1  %}


{% if collection and collection.products.size  < 20 %}

Obviously, this does not work, but does anyone know how to do something like this?

I saw Caroline's docs on how to retrieve related products 4 ways, but that's a bit complicated for me and this would make the most sense for my site since I have many collections that have a small number of products in them.

I appreciate the help.