Put in Previous / Next navigation buttons on product page to get to next/previous product?

Topic summary

A user seeks to add Previous/Next navigation buttons on product pages, allowing customers to browse between products within a collection without returning to the collection page. They’re using the Vision theme and comfortable with CSS implementation.

Solution Provided:

A working solution involves two main steps:

  • Update snippets/card-product.liquid by modifying all product URLs to include | within: collection
  • Add navigation button code to sections/main-product.liquid that displays Previous/Next links when products exist in a collection

Key Refinements:

  • Layout fix: Initial implementation had positioning issues when viewing the first product (Next button appeared on left instead of right). This was resolved with additional CSS code.
  • Customization: Icon color can be changed using CSS targeting .next-prev-icons svg path
  • Theme compatibility: While the solution reportedly works across all themes, implementation varies for premium/non-free themes (Honey, Canyon) where theme structure differs and may require custom adjustments.

Status: The core solution is confirmed working by multiple users. Questions remain open for specific premium theme implementations, with offers to provide customized code if theme files are shared.

Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

Hi,

I am wondering how to put Previous / Next navigation buttons on product page to get to next/previous product so my customer can click to the next product without having to go back to the collection? Ideally above the image and under the breadcrumb (or on the breadcrumb line)

I am aware it will only work for products pages that are being viewed within a collection URL. Which I think I have!

I have the Vision Theme

I am good with inputting a CSS code. Any help would be very much appreciated!

For accessing the next or previous product, different logics can be used. Some utilize identification-based methods, while others opt for similar collections to determine the next or previous product ID. Which approach do you prefer?

Also, which theme are you currently working on? Knowing this will make it easier for me to provide a suitable response.

Hi,

May I suggest to update code these steps:

  1. Go to Store Online-> theme → edit code

  1. Snippets/card-product.liquid

  2. update all ‘href="{{ card_product.url }}’ to ‘href=“{{ card_product.url | within: collection }}”’. NOTE: added “| within: collection”

  3. Go to sections/main-product.liquid

  4. Add code below to top of file

{% if collection.previous_product or collection.next_product %}

    

        {% if collection and collection.previous_product %}
        
            
            Prev
        
        {% endif %}
        {% if collection and collection.next_product %}
        
            Next
            
        
        {% endif %}
    

{% endif %}
2 Likes

Thank you so much!

Thank you so much! It worked for me☺️

Does this code provide a side bar or a “next product” button on each individual product? I added it to my store and it didn’t do anything.

This code show next previous button at the top of product page.

Hi @mega-licios ,

You need update product url as well.

EBOOST_0-1715685441267.png

Will this work for Enterprise theme?

Hi,

It works for all themes.

Is there a way to change the chevron icon colour?

Thanks :slightly_smiling_face:

You can add code below to change color icon to red

.next-prev-icons svg path { fill: red;}

2 Likes

It works but needs a slight tweak. The problem is, if it is the first product in the collection, Next is on the left side but it should be on the right side with Prev on the left side and greyed out/hidden. If you go to next product, Next is on the right side and Prev is on the left side (as it should be). The last product in the collection is fine since Prev is on the left. How to keep Next on the right side when it is the first product in the collection?

Hi @phoenixwil ,

You can add code below to top sections/main-product.liquid file


1 Like

Yup, that worked. Thank you for your awesomeness.

Will the Next & Previous buttons work with the Honey Theme. My product pages are mostly collections.

I would like to add them right above the review hearts. Please advise.

Hi @Shereegraham ,

This is not free theme. I am not sure theme’s structure. So could you please share code of sections/main-product.liquid file. I help to add code for you.

Any idea if this works with the canyone theme? if so where do I add this?

Hi @Arielle_5 ,

This theme is not free. So We are not sure this theme structure. Could you let us access your store? Or send theme to we can check it?