How can I list all products not in any collection

Highlighted
Tourist
3 0 1

Hi guys, Please help a newb out... I have 3000 products and I am trying to find a list of any products that are 'orphaned' - not captured by any of my automated collections... 

I believe to do this I will need to create a new template with code such as the following below:

<ul>
{% paginate collections.all.products by 2000 %}
{% for product in collections.all.products %}
{% if product.collections.size < 2 %}
<li>{{ product.title | link_to: product.url }}</li>
{% endif %}
{% endfor %}
{% endpaginate %}
</ul>

Can someone please give me the exact steps to make this display?

I have tried making a collections template with the above code, then applied to a new collection which showed all products - but this simply showed all products... 

Thanks in advance!

 

 

Highlighted
Shopify Expert
265 1 16

Hey Mark, 

Can I have the link where you're doing that please? Also if you can output to console, the product object {{ product | json }} I'd be able to take a deeper look.

Best,

Jarvis

Jarvis @ Kaleido
- Slow Shopify Store? Install our PageSpeed Magic app.
- Have more questions? Feel free to email me.
- My reply helped? Click Like to show me some love!

0 Likes
Highlighted
Tourist
3 0 1

Hi Jarvis, to be honest not sure what you are asking there - our shopify link is https://monsterthreads.myshopify.com/

As stated, I'm looking for a way to view any products that don't get captured in any shopify automated collection. This way if my rules don't capture some items, I can create new collection rules so every product is in some collection or the other. 

cheers

 

0 Likes
Highlighted
Shopify Expert
265 1 16

Hey Mark,

I wanted to know the page where you have this code:

<ul>
{% paginate collections.all.products by 2000 %}
{% for product in collections.all.products %}
{% if product.collections.size < 2 %}
<li>{{ product.title | link_to: product.url }}</li>
{% endif %}
{% endfor %}
{% endpaginate %}
</ul>

and to do a console log of {{ product | json }} so I can take a look at the product and its collections information in order to determine how best to do the filtering.


Hope that makes sense,

Jarvis @ Kaleido
- Slow Shopify Store? Install our PageSpeed Magic app.
- Have more questions? Feel free to email me.
- My reply helped? Click Like to show me some love!

0 Likes
Highlighted
Tourist
3 0 1

Hi Jarvis, 

I don't have that code anywhere -  It's code pasted from another link on here by another user.

I don't know how to do a  console log of {{ product | json }}, however  it is a general question that should apply to all users, not to any particular products/collections on my site. 

cheers

 

 

 

0 Likes
Highlighted
Shopify Partner
2 0 0

Hi Jarvis

I have created a page using the code you provided, thank you.

 

Do you have any idea why this is not working, well it lists some products but not all of them.

 

<div class="page-width">
  <div class="grid">
    <div class="grid__item medium-up--five-sixths medium-up--push-one-twelfth">
      <div class="section-header text-center">
        <h1>Products that not belong to a collection</h1>
      </div>

      <div class="rte">
        <ul>
          {% paginate collections.all.products by 10000 %}
          {% for product in collections.all.products %}
          {% if product.collections.size < 1  %}
          {% assign x = 'https://rawbrass.myshopify.com/admin/products/' %}
          {% assign z = x | append: product.id %}         

         
          <li class="yet-another-collectionless-product">{{ product.title | link_to: z }}</li>
          {% endif %}
          {% endfor %}
          {% endpaginate %}
          </ul>
      </div>
    </div>
  </div>
</div>
0 Likes
Highlighted
Excursionist
12 0 6

Di you ever figure out how to do this? I need it for my site.

0 Likes