Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
i copy and paste the liquide provide on the site to add my previous and next page button. My previous and next page button link works well for all the collection except one. Could some one please help out to check what went wrong. The following is the liquid i locate from the site.
And the actual website page to show my problem
(with the previous and next button )
(without the previous and next button)
{%- liquid
assign previous_product = collection.previous_product
assign next_product = collection.next_product
if previous_product or next_product
else
assign collectionList = product.collections[0].handle
assign previous_product = nil
assign next_product = nil
assign last = collections[collectionList].products_count
for p in collections[collectionList].products
if p.handle == product.handle
assign prev = forloop.index | minus: 2
assign next = forloop.index
if prev >= 0
assign previous_product = collections[collectionList].products[prev].handle
endif
if last >= next
assign next_product = collections[collectionList].products[next].handle
endif
break
endif
endfor
endif
-%}
{%- if previous_product -%}
<a class="next-prev-icon prev-icon" href="{{ previous_product }}">
Previous
</a>
{%- endif -%}
{%- if next_product -%}
<a class="next-prev-icon next-icon" href="{{ next_product }}">
Next
</a>
{%- endif -%}
Solved! Go to the solution
This is an accepted solution.
Hi @minhsien,
The next and previous button is only displayed when you visit the collection page and have a product link: https://mzakkaya.com/collections/trendy/products/kids-sunscreen-lace-lace-breathable-bucket-hat
So you need to change the product link in step 1 as per my previous instructions.
Hope it is clear to you.
Hi @minhsien,
I have checked and the products are not working well. Can you send me the product link that works well? I will check it.
You can also refer to my previous tutorial: https://community.shopify.com/c/shopify-design/add-previous-and-next-buttons-to-dawn-theme/td-p/1461...
Hope it helps!
Hi @minhsien,
Please find 'card_product.url', change
card_product.url
=>
card_product.url | within: collection | default: '#'
Hope it helps!
https://mzakkaya.com/products/kids-sunscreen-lace-lace-breathable-bucket-hat
https://mzakkaya.com/products/summer-childrens-short-sleeved-boy-t-shirt-cotton-bottoming-top
https://mzakkaya.com/products/t-shirt-slub-cotton-casual-top
Please check above. These products are in the same collection, howewver some products did not show the previous and next link as well. And i might need to move the link to the right side of the page.
This is an accepted solution.
Hi @minhsien,
The next and previous button is only displayed when you visit the collection page and have a product link: https://mzakkaya.com/collections/trendy/products/kids-sunscreen-lace-lace-breathable-bucket-hat
So you need to change the product link in step 1 as per my previous instructions.
Hope it is clear to you.
Thanks for the effort! it looks and work well
Hi @minhsien put this line in your collection page
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025