Shopify themes, liquid, logos, and UX
Hi all, my wife and I are preparing our new Shopify based shop at the moment. I've already cleared lots of questions with old community posts. Thanks to all of you out there! Now I've encountered an issue I can't find:
We'll have a special Collection page for each brand that we sell with
- a collection banner
- their collections
- a collection with the in-stock items
- a product grid with all of their items
If we change pages in the product grid it loads the 2nd page and scrolls to the top.
Can I change the behaviour of the pages that the 1st page is loaded at the top but the 2nd and following pages will be loaded at the position of the product grid.
see here a maximum zoomed out view to explain:
I hope that's understandable and I expect it's a very easy solution if you just know what search terms to use 🙂
Thanks a lot in advance and have a nice weekend!
Hi @gork!
Super to know you've starting your Shopify store, I'll try my best to resolve the issue you've been facing. Looking at your detailed explanation of the pagination issue, I understand you want to maintain the scroll position for pages 2+ while keeping the default top-scroll behavior for page 1 of your collection pages.
To achieve this, you'll need to modify your theme's JavaScript. Look for the pagination handler in your theme files (often in pagination.js or collection.js) and add a condition to check the page number. Here's how you can approach it:
Something like this should work:
// In your pagination handler: if (currentPage > 1) { // Store current scroll position const scrollPosition = window.scrollY; // After content loads, restore scroll position window.scrollTo({ top: scrollPosition, behavior: 'instant' }); }
This will maintain the scroll position for any page after the first one, while keeping the default scroll-to-top behavior for page 1.
Hope this helps with your collection pages! Let me know if you need any clarification. In case you want us to do it for you, feel free to DM or email your collaborator code.
Cheers!
Shubham | Untechnickle
Helping for free: hello@untechnickle.com
Don't forget to say thanks, it'll make my day - just send me an email!
Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App
Thanks for the prompt feedback.
However I understand this will affect all pages not just the one and there will be different variants for different brands.
Also if possible I would prefer to link the y-value to a certain section in the page as the collections and products above will vary and today's y-value can change by tomorrow.
Hi! Thanks for the update. Since you've added the all-products div, here's a more targeted solution that will work across your brand collection pages:
// Add this to your theme's JavaScript files document.addEventListener('DOMContentLoaded', function() { // Only run on collection pages with the all-products div const allProductsSection = document.getElementById('all-products'); if (!allProductsSection || !window.location.pathname.includes('/collections/')) return; // Get all pagination links const paginationLinks = document.querySelectorAll('.pagination__item a, .pagination__link'); paginationLinks.forEach(link => { link.addEventListener('click', function(e) { e.preventDefault(); const url = new URL(this.href); const targetPage = url.searchParams.get('page'); // For page 1, remove any hash and scroll to top if (targetPage === '1' || !targetPage) { window.location.href = url.origin + url.pathname + url.search; return; } // For other pages, add the #all-products anchor window.location.href = `${url.origin}${url.pathname}${url.search}#all-products`; }); }); });
This solution:
To implement:
You can test it by clicking through your pagination - page 1 should scroll to top, while other pages should scroll to your product grid section.
Let me know if you need any adjustments or clarification!
Shubham | Untechnickle
Helping for free: hello@untechnickle.com
Don't forget to say thanks, it'll make my day - just send me an email!
Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App
Hello @gork
Thank you for submitting your query to the Shopify community. I’d be happy to assist you. Could you please provide the store URL and password (if it’s password-protected) so I can review and get back to you with an update?
The collection is question can be found here:
http://qrws9g-k8.myshopify.com/collections/aurora
Shop PW: tabnew
I want to "aim" for the rich text section "All Aurora Products" and prefer not to have a fixed value of scroll behaviour as the collections, texts and products before hat may vary. I would adapt this solution to the other brand pages that we're putting together right now - I expect to have the same issue there as well as they would be made pretty similar.
I now added an empty div id "all-products" and i can scroll there with a link.
How do i tell the system to add #all-products to the page changer?
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