I want to get the products using product type. Right Now it’s getting the products using product vendor..
{% if collection == null or collection.handle == ‘frontpage’ or collection.handle == ‘all’ %}
{% assign found_collection = false %}
{% for c in product.collections %}
{% if found_collection == false and c.handle != ‘frontpage’ and c.handle != ‘all’ and c.all_products_count > 1 %}
{% assign found_collection = true %}
{% assign collection = c %}
{% endif %}
{% endfor %}
{% endif %}
Related Products
{% if settings.related_products_per_row != blank and settings.related_products_per_row != '5' %}
{% assign product_grid = 12 | divided_by: settings.related_products_per_row %}
{% assign columns = true %}
{% endif %}
{% assign current_product = product %}
{% assign current_product_found = false %}
{% for product in collection.products limit:settings.nuber_of_related_product_to_show %}
{% if product.handle == current_product.handle %}
{% assign current_product_found = true %}
{% else %}
{% unless current_product_found == false and forloop.last %}
{% include 'product-grid-item' %}
{% endunless %}
{% endif %}
{% endfor %}
r8r
September 11, 2021, 8:05am
2
@arslanaslamch - the code you provided is just generic collection list code. you need to create the appropriate product type based collections before you can use them:
Products > Collections > Create Collection
Should you only want to list type-based collections, you can apply meta fields to the collections and modify the liquid code to filter by those.
Mario
I Understand brother. I know this thing but I want to do it manually using codes. I am using it on a single product page. I want when someone visits any product on my website in related products its show all the brother by there product type automatically.
r8r
September 11, 2021, 1:16pm
4
@arslanaslamch How many products do you have?
I have around 10 products in that product type.
r8r
September 12, 2021, 6:56am
6
@arslanaslamch - and how many in total?