Shopify Development

Elevate Your Shopify Mobile Experience: Customizing Menu Font Sizes and Adding Login Buttons Without Apps

As a Shopify migration expert at Shopping Cart Mover, we constantly emphasize the importance of a seamless and intuitive mobile shopping experience. In today's e-commerce landscape, mobile traffic often dominates, making your mobile interface a critical factor in conversion rates and customer satisfaction. A recent discussion in the Shopify Community forums perfectly highlighted two common customization requests that significantly impact mobile UX: adjusting the mobile menu drawer's font size and integrating accessible Login/Sign Up buttons.

Our client, veluxe1, sparked this valuable conversation, seeking to implement these changes using custom code rather than relying on additional apps. This approach is commendable, as minimizing app dependencies can lead to faster load times, reduced maintenance, and a more streamlined store overall. The consensus from the community's seasoned developers like markjohn1, WebsiteDeveloper, and Devcoder was a resounding 'Yes!' – these enhancements are entirely achievable with a bit of CSS and Liquid file editing. Let's dive into how you can empower your Shopify store with these essential mobile menu tweaks.

Customized Shopify Mobile Menu with Smaller Fonts and Login/Sign Up Buttons
Customized Shopify Mobile Menu with Smaller Fonts and Login/Sign Up Buttons

Precision Control: Giving Your Mobile Menu a Font Size Makeover

Veluxe1's desire for a 'much smaller' mobile menu font is a common need. Whether you have an extensive navigation structure, want a cleaner aesthetic, or need to optimize for specific mobile screen sizes, custom font sizing offers the flexibility to perfect your store's look and feel. The default theme settings don't always cater to every brand's unique design vision, making custom CSS an indispensable tool.

How to Adjust Mobile Menu Font Size:

  1. Access Your Theme Code: From your Shopify admin, navigate to Online Store > Themes.
  2. Edit Code: Find your current theme, click Actions, then select Edit Code.
  3. Locate Your CSS File: In the 'Assets' folder, look for a file named base.css. Depending on your theme, it might also be theme.css, custom.css, or sometimes within a `sections` or `snippets` folder if your theme uses more modular CSS. base.css is a common and safe place for global styles.
  4. Paste the Custom CSS: Scroll to the very bottom of this file and paste the following CSS code. This code specifically targets the mobile menu drawer items when the screen width is 749 pixels or less.
@media screen and (max-width: 749px) {
  .menu-drawer__menu-item--mainlist .menu-drawer__menu-item-text {
    font-size: 14px !important; /* Adjust this value as needed for main menu items */
  }

  .menu-drawer__menu-item--child .menu-drawer__menu-item-text {
    font-size: 12px !important; /* Adjust this value for nested/child menu items */
  }
}
  • Understanding the Code: The @media screen and (max-width: 749px) rule ensures these styles only apply to mobile devices (screens up to 749 pixels wide).
  • .menu-drawer__menu-item--mainlist .menu-drawer__menu-item-text targets the primary navigation links within your mobile menu.
  • .menu-drawer__menu-item--child .menu-drawer__menu-item-text targets any sub-menu or nested links, allowing for a hierarchical font size if desired.
  • The !important declaration is used here to override any existing theme styles. While generally used sparingly, it's often necessary for quick overrides in specific contexts like this.

Pro Tip: Experiment with different font-size values (e.g., 12px, 10px) to find what best suits your theme's design and readability. Always test these changes on actual mobile devices or using your browser's developer tools to ensure optimal display across various screen sizes.

Seamless Access: Adding Login and Sign Up Buttons to Your Mobile Drawer

Providing quick access to Login and Sign Up options directly within the mobile menu drawer significantly enhances the user experience, especially for returning customers or those ready to create an account. It streamlines the journey, reducing clicks and potential friction points.

How to Add Login/Sign Up Buttons:

  1. Identify the Drawer File: In your theme's 'Sections' or 'Snippets' folder, look for files like header-drawer.liquid or menu-drawer.liquid. These files typically control the content and structure of your mobile menu drawer.
  2. Insert the Liquid Code: Locate a suitable position towards the bottom of the drawer's markup in the identified file. This is where your new buttons will appear. Paste the following Liquid code:
{% if customer %} {% else %} {% endif %}
  • Understanding the Liquid: The {% if customer %} logic checks if a user is currently logged in. If they are, it displays a 'My Account' link. Otherwise, it shows 'Login' and 'Sign Up' buttons.
  • {{ routes.account_url }}, {{ routes.account_login_url }}, and {{ routes.account_register_url }} are Shopify's built-in Liquid objects that automatically generate the correct URLs for account pages, ensuring your links are always functional.
  1. Add Styling CSS: Return to your base.css (or equivalent) file and paste the following CSS at the bottom to style your new buttons. This will arrange them neatly and give them a basic design.
.mobile-auth-buttons {
  display: flex;
  gap: 10px; /* Space between buttons */
  padding: 20px; /* Padding around the button container */
  margin-top: 20px; /* Space above the buttons */
  flex-wrap: wrap; /* Allow buttons to wrap on very small screens */
}

.auth-btn {
  flex: 1; /* Distribute space evenly among buttons */
  text-align: center;
  padding: 12px 15px;
  border: 1px solid #000;
  text-decoration: none;
  color: #000;
  border-radius: 12px; /* Rounded corners as requested by veluxe1 */
  transition: all 0.2s ease-in-out; /* Smooth hover effects */
}

.auth-btn:hover {
  opacity: 0.8;
}

.signup-btn {
  background: #000;
  color: #fff;
}

.signup-btn:hover {
  background: #333;
  color: #fff;
}
  • Customizing Button Styles: You can easily change the background, color, border, and border-radius values to match your brand's aesthetic. The flex: 1; property ensures the buttons expand to fill the available space, creating a clean, organized look.
  • The border-radius: 12px; specifically addresses veluxe1's follow-up question about making the buttons rounded.

Remember to click 'Save' after making changes to your Liquid and CSS files!

Best Practices for Shopify Theme Customization

While custom coding offers immense flexibility, it's crucial to follow best practices to ensure your store remains stable and easy to manage:

  • Always Duplicate Your Theme: Before making any code changes, create a duplicate of your live theme (Online Store > Themes > Actions > Duplicate). This provides a safe rollback point if anything goes wrong.
  • Test Thoroughly: After implementing changes, test your mobile menu on various devices and browsers to confirm everything looks and functions as expected.
  • Document Your Changes: Keep a record of the custom code you've added and where. This helps with future updates or troubleshooting.
  • Consider Theme Updates: Major theme updates can sometimes overwrite custom code. Be prepared to re-apply your customizations if you update your theme version.

By implementing these custom code solutions, you can significantly enhance your Shopify store's mobile user experience without the overhead of additional apps. This not only improves navigation and accessibility but also contributes to a faster, more responsive website – crucial for retaining customers and driving conversions.

Whether you're looking to fine-tune your existing Shopify store, migrate from another platform, or start a Shopify store from scratch, the team at Shopping Cart Mover is here to help. Our expertise in Shopify development and migrations ensures your e-commerce platform is optimized for performance, user experience, and growth. Don't let a clunky mobile menu deter your customers; empower your store with thoughtful, custom solutions.

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases