How to compare the handle for all products ?
Loop through entire collection which includes all the products
{% assign entireproducts = collections[‘entire-collection’].products %}
{% assign entireproducts = collections[‘entire-collection’].products %}
{% assign available_products = 0 %}
{% for product in entireproducts %}
{% assign available_products = available_products | plus: 1 %}
{% for variant in product.variants %}
{% endfor %}
Can you please explain it more ?
I have duplicate products which offer same size or different size products with same title but vendors is different. I want to display products which ever cheaper in my website. So my website will always display products from one vendor only ( Which ever cheaper ). In product details page i want to check this logic to find the same title products from different vendors. I tried the below code . When i given the handle statically then it is showing other vendor products finely. I want to make it dynamic. Can anybody help me on this.
Now i want to display the lowest price product if available.
Product is having different sku,handle, price but title is same.
Please help me to show lowest price product.
{% assign some_handle = product.handle %} {% assign custom_product = all_products[some_handle] %}
i tried this code in product_template.liquid file but it is not working as expected.
Hi @Samruddhi
I think you can do like this
{% assign productTitle = product.title %}
{% assign allProductsWithSameTitle = collection['all'].products | where: "title", productTitle %}
{% assign productsSortByPrice = allProductsWithSameTitle | sort: "price" %}
{% assign lowesePriceProduct = productsSortByPrice | first %}
Thanks!