How to retrieve products not owned by customer?

Highlighted
Excursionist
25 2 5

Hi, 

 

I'm looking for a solution for getting a list of products that the user does not own. 

I know i can iterate through products in a collection with :

 

{% for product in collections.all.products %}
{ endfor %}

 

I also know i can iterate through a a list of items that the user owns with:

 {% for order in customer.orders %}
  {% assign line_item = order.line.items %}
  {% for line_item in order.line_items %}
  {% endfor %}
{% endfor %}

 

 

But how do I iterate through a list of items that contain all products excluding the ones that are own by the customer?

 

Any help would be highly appreciated!

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
0 Likes