Shopify Header Hack: Left-Aligned Logo & Custom Search Bar Magic!

Level Up Your Shopify Header: A Community-Driven Guide

Ever feel like your Shopify store's header just isn't quite *right*? Maybe the logo's in the wrong spot, the search bar's too short, or there's just too much empty space. You're not alone! I recently stumbled upon a great discussion in the Shopify community where a store owner, sawez, was tackling exactly these issues. Let's dive into the problem and the solutions that were shared – it might just be what you need to give your store that perfect look.

The Header Headache: Defining the Problem

sawez's goal was to revamp their desktop header layout. They wanted to move the logo to the left, stretch out the search bar, keep the login/cart on the right, and tighten up the spacing between the header rows. Here’s a quick recap of the original request:

  • Move the logo to the left side of Row 1.
  • Move the search bar to the left-middle of Row 1 and make it very long.
  • Keep the login and cart on the right as they are.
  • Keep the navigation / header titles below (Row 2).
  • Reduce the vertical space between Row 1 and Row 2 so the header is more compact.

Here's what sawez was aiming for:

Shopify require help pls

CSS to the Rescue: Community Solutions

The community really stepped up to help! One helpful member, StackingContext, provided some custom CSS snippets that addressed the layout challenges. These snippets are designed to be added to your theme's CSS file (usually in the theme editor under "Assets" -> "theme.scss.liquid" or a similar file, depending on your theme). Always back up your theme before making changes!

Here's the first snippet StackingContext suggested:

@media (min-width: 989px) {
  .header {
    display: flex;
    flex-wrap: wrap;
  }
  
  .header__search {
    display: none;
  }
  
  .header__heading {
    grid-area: unset;
    margin-right: auto;
  }
  
  .header__icons {
    flex: 1;
    width: 100%;
  }
  
  .desktop-search {
    flex: 1;
  }
  
  .header__inline-menu {
    order: 3;
    margin: auto;
  }
  
  .search-modal__form {
    max-width: unset;
    padding-inline: 30px
  }
}

sawez tried this code, but unfortunately, it didn't quite work as expected. It resulted in a layout issue as seen in this image:

Shopify req help header

StackingContext then refined the code. Here's the updated snippet:

@media (min-width: 989px) {
  .header {
    display: flex;
    flex-wrap: wrap;
  }

  .header__search {
    display: none !important;
  }
  
  .header__heading {
    grid-area: unset;
    margin-right: auto;
  }
  
  .header__icons {
    flex: 1;
    width: 100%;
  }
  
  .desktop-search {
    flex: 1;
  }
  
  .header__inline-menu {
    order: 3;
    margin: auto !important;
  }
  
  .search-modal__form {
    max-width: unset;
    padding-inline: 30px
  }

  predictive-search {
    display: flex;
  }
}

StackingContext even showed what it looked like on their test store:

image

Hiding the Search Icon: A Quick Fix

sawez also found a way to hide the search icon using this CSS:

.icon.icon-search {
  display: none;
}

While this doesn't solve the entire layout issue, it's a helpful snippet if you want to remove the default search icon.

Putting It All Together: A Step-by-Step Approach

Based on the community discussion, here's a consolidated approach to customizing your Shopify header:

  1. Backup Your Theme: Always, always, *always* back up your theme before making any code changes.
  2. Access Your Theme's CSS: Go to your Shopify admin, then "Online Store" -> "Themes." Click "Edit code" on the theme you want to modify.
  3. Locate the CSS File: Find the main CSS file. It's often named "theme.scss.liquid" or something similar under the "Assets" folder.
  4. Add the CSS Snippet: Paste the refined CSS snippet provided by StackingContext into your CSS file.
  5. Adjust as Needed: You might need to tweak the CSS further to perfectly match your theme's structure and your desired layout. Use your browser's developer tools (right-click on the page and select "Inspect") to identify the relevant CSS classes and adjust the values accordingly.
  6. Save and Test: Save your changes and preview your store. Test on different devices (desktop, mobile) to ensure the layout looks good everywhere.

Customizing your Shopify header can feel a bit daunting, but with the help of the community and a little CSS magic, you can achieve the exact look you're after. Remember to experiment, test, and don't be afraid to ask for help if you get stuck! It's all about finding what works best for your brand and creating a seamless shopping experience for your customers.

Share:

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools