How to: add next/previous links on the product page

Highlighted
New Member
2 0 0

Hello

I have Brooklyn theme, I'd like to add a button under the product description to link next/previous product page.

I'm ready to edit the code.

Please help me

0 Likes
Shopify Partner
856 6 142

Hi Alice,

You can do that by adding following

{% if collection.previous_product %}
  {{ 'Previous' | link_to: collection.previous_product.url, 'Previous product' }}
{% endif %}

{% if collection.next_product %}
  {{ 'Next' | link_to: collection.next_product.url, 'Next product' }}
{% endif %}

which is also documented here and here for previous and next respectively.

This will only work for products pages that are being viewed within a collection URL.

Best wishes!

I turn coffee in to code - since 1998
0 Likes