How to make page scroll to top when selecting and unselecting the filter

Topic summary

Main issue: Make the page automatically scroll to the top when a user selects or unselects product filters in a Shopify store.

What was tried: A code snippet was suggested to be added to theme.liquid before the closing tag (via Online Store > Themes > Edit code). The initial attempt did not work for the requester.

Resolution: Another set of steps reiterated adding a JavaScript snippet at the bottom of theme.liquid above . After applying this, the requester confirmed it worked.

Key details:

  • The solution involves adding JavaScript to handle filter change events and trigger a scroll-to-top action.
  • File/location: theme.liquid (global theme file), placed just above .
  • Exact code is referenced but not visible in the provided text (code blocks omitted), yet implementing the advised placement resolved the issue.

Status: Resolved. No outstanding questions; an additional refinement was suggested afterward, but the functionality was already confirmed working.

Summarized with AI on January 15. AI used: gpt-5.

Please try to update code like this and check again