Get Collections.Products in Collections page

Hi

In the collection page(with total 5 paginate page), the paginate page 1 could show below variable

{{ collections[tag_collections].products_count }} = 100
{{ collections[tag_collections].products.size }} = 100

However, if click to page 2, it show

{{ collections[tag_collections].products_count }} = 100
{{ collections[tag_collections].products.size }} = 0

Why on pages 2-5 lost all the products as we cannot get the tags inside.

Please advise, thanks.

If you are referencing a collection like this you won’t be paginating through them.

{{ collections[tag_collections].products }}

You will be able to get some basic data returned about the collection but you won’t get a “second page” - only the first default set of data.

Can you like to the page where you have the code in place?

Thanks for reply.

Anyway to get through the collection on the second page?

Unless it’s within a paginated set no. Not with Liquid anyway.
You could use JavaScript to pull the data in via an ajax call.

What are you trying to build/why do you need it?

o…

What I want to do is loop through specific collections to get related data on the collection page.

My shop separates the same style but different colors into different products, I want to show the color swatches under the product photo on the collection page, so I loop through the specific collection and get related SKU which was marked in tags, but it just can show on the first page but not the other.

Any way/example could do this in Liquid?

I’m quite new to Shopify, thanks.