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.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025