This script is based on (this)[https://github.com/programmerhabib/load-more-button-on-shopify-collection-page/blob/main/load%20more%20product%20button.txt]
I’m using the Dawn Theme with Tailwind. To get this visually work you will need to install tailwind. Otherwise you have to write your own CSS for the Button + Spinner.
- Add Next page as data attribute to product grid on your collection page:
data-next-url="{{paginate.next.url}}"
Looks like this in Dawn:
<ul id="product-grid" data-id="{{ section.id }}" class="flex-grid product-grid ..." data-next-url="{{paginate.next.url}}">
- Add
main-collection-product-grid.liquid
content to the end of the grid on your collection page. - Include the script on the collection page
{% if template contains 'collection' %} <script src="{{ 'collection-load-more.js' | asset_url }}" defer="defer"></script> {%endif%}
- Check the class name of your product items / card (default is
.grid__item
if different change Line 26 in the javascript file.