All things Shopify and commerce
Hi,
I am developing an app for which I was trying to fetch the products and sort them on the basis of price, and created time. So I created a collection template and made the request to it. I named this 'templates/collection.test.liquid'.
{% layout none %}
{% capture productsJson %}
{% paginate collection.products by 25 %}
{{ collection.products | json }}
{% endpaginate %}
{% endcapture %}
{{ productsJson }}
Then to get products sorted by price descending I would make a fetch request from shop to this link
https://some-kind-of-example.myshopify.com/collections/all?view=test&sort_by=price-descending
and I will get the JSON data.
Now the problem is when app will be created I had to create this template for user. But I can't as it is not allowed.
Can I do the same thing with theme app extension ?
I have tried to get the liquid code in this way
{% assign allProducts = collection["all"].products %}
{% for product in allProducts %}
{{ product.title }}
{% endfor %}
but this code only fetches the first 50 products. And if try to sort them, it will just do the sorting in those products.
I need help regarding this.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024