this helped me add the search bar in the header but it is also showing on mobile. I need to hide it in the mobile and only need the icon on the mobile.
Thank you for your reply. I’m glad to hear that the solution worked well for you. If you require any more help, please don’t hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.
To hide the search bar on mobile devices while keeping the icon visible, you can use CSS media queries. Add the following CSS to your theme’s stylesheet (usually in theme.css or theme.scss.liquid):
This code hides the search bar and only displays the search icon on mobile devices (below 768px screen width). You’ll need to ensure that the search bar has a class like .search-bar and the search icon has a class like .search-icon. Adjust the classes as necessary based on your theme’s HTML structure.