Filter only available products while using pagination

Topic summary

Problem Identified:
Users are attempting to filter out unavailable products from paginated collections in Shopify’s Liquid templating system. The standard pagination doesn’t automatically exclude out-of-stock items, causing display issues.

Proposed Solution:
The original poster suggests modifying collection-template.liquid by:

  • Changing the pagination tag to include a where filter: {% paginate collection.products | where: "available", true by 20 %}
  • Updating the product loop to check availability conditions

Current Status:
The solution appears unresolved with mixed results:

  • Multiple users report the suggested code modifications did not work for their implementations
  • One user attempted applying similar logic to blog articles with tag filtering, encountering issues
  • A follow-up question asks whether the pagination displayed incorrect page counts or failed to hide filtered products

Note: The code snippets in the original post contain reversed/garbled text, making exact implementation details unclear.

Summarized with AI on November 21. AI used: claude-sonnet-4-5-20250929.

What behavior did you observe from this? Did the pagination display the normal number of pages and hide the products that did not meet the criteria?