Shopify Dawn Theme: Custom Text for Cart & Search Icons
Hey fellow store owners and developers! Ever looked at your Shopify store's header and thought, "You know, those icons are great, but I'd really prefer some clear text there?" Perhaps you envision a prominent "CART (X)" instead of a subtle shopping bag icon, or a straightforward "SEARCH" instead of a magnifying glass. You're not alone in this desire for a cleaner, more text-driven user experience.
This exact customization challenge recently emerged in the Shopify community, initiated by @oshop0307, who was using the popular Dawn theme (version 15.1.0). They sought to transform their cart and search icons into clear, actionable text, even providing a screenshot to illustrate their desired outcome. This sparked a valuable discussion, yielding a couple of robust solutions that we, as Shopify migration experts at Shopping Cart Mover, are excited to break down for you.
Customizing your Shopify store's header isn't just about aesthetics; it's about enhancing brand identity, improving user clarity, and potentially boosting conversion rates by making key navigation elements immediately understandable. Let's dive into these actionable steps to give your Shopify store a unique, text-based header.
Safety First: Always Duplicate Your Theme!
Before we even think about touching any code, there's one golden rule that every experienced Shopify store owner and developer lives by: Always, always, DUPLICATE YOUR THEME first! Seriously, we cannot stress this enough. Go to Online Store > Themes, click the three dots next to your live theme, and select 'Duplicate.' This creates a safe, restorable backup of your current theme. If anything goes awry during the code editing process (which, let's be honest, can happen even to the best of us!), you can simply revert to your duplicate or publish the original theme again. This crucial step, wisely highlighted by Mateo-Penida in the original thread, is your safety net against potential downtime and headaches.
Solution 1: The Direct Code & CSS Approach (The Developer's Choice)
The first set of solutions, championed by contributors like Devcoder and Mateo-Penida, involves directly modifying your theme's Liquid files to replace the icon code with text, then adding some CSS to ensure it looks precisely as intended. This method offers the most granular control over the HTML structure and presentation.
Understanding the Files: header.liquid, header-search.liquid, base.css
Sections > header.liquid: This file typically controls the main header structure of your theme, including navigation, logos, and often the cart icon.Snippets > header-search.liquid: Many themes, especially Dawn, separate the search functionality into a reusable 'snippet' file for modularity.Assets > base.css: This is your theme's primary stylesheet, where you'll add custom CSS rules to override default styles and ensure your new text elements are properly formatted.
Step-by-Step: Changing the Cart Icon to Text
Navigate to Online Store > Themes > Actions > Edit code. Then open Sections > header.liquid.
Search for the original cart icon code block (around line 288 in Dawn 15.x):
{% if cart == empty %}
{{ 'icon-cart-empty.svg' | inline_asset_content }}
{% else %}
{{ 'icon-cart.svg' | inline_asset_content }}
{% endif %}
{{ 'templates.cart.cart' | t }}
{%- if cart != empty -%}
{%- if cart.item_count < 100 -%}
{%- endif -%}
{{ 'sections.header.cart_count' | t: count: cart.item_count }}
{%- endif -%}
Replace this entire block with the simplified text version:
CART
{% if cart.item_count > 0 %}
({{ cart.item_count }})
{% endif %}
This code directly inserts the text "CART" and dynamically displays the item count if the cart is not empty. The original `svg-wrapper` and `visually-hidden` spans are removed, as their functionality is now handled by the visible text.
Step-by-Step: Changing the Search Icon to Text
Next, open Snippets > header-search.liquid.
Search for the original search icon code block:
{{- 'icon-search.svg' | inline_asset_content -}}
{{- 'icon-close.svg' | inline_asset_content -}}
Replace it with this simplified text version:
SEARCH
Here, the `svg-wrapper` containing the search icon is replaced directly with a `` containing the text "SEARCH".
Styling with CSS
Finally, to ensure your new text elements are properly aligned and styled, open Assets > base.css and paste the following code at the very bottom of the file:
.header__icon--cart span,
.header__icon--search span {
display: flex;
align-items: center;
gap: 8px;
white-space: nowrap;
}
#cart-icon-bubble {
display: flex;
align-items: center;
}
.header__icons {
display: flex;
align-items: center;
gap: 16px;
}
.header__icon--cart,
.header__icon--search {
text-decoration: none !important;
}
.header__icon--cart span,
.header__icon--search span {
text-decoration: none !important;
}
This CSS ensures the text is displayed correctly, removes any default icon styling, and provides basic alignment. The `!important` tags are used to override any conflicting theme styles, ensuring your text links appear as intended.
Solution 2: The CSS-Only Approach (For Minimal Liquid Edits)
An alternative, less intrusive method, proposed by tim_tairli, uses CSS to hide the existing icons and inject text, without directly altering the Liquid structure as much. This can be beneficial for theme updates, as it minimizes direct modifications to core Liquid files.
Why a CSS-Only Solution?
The primary advantage of a CSS-only solution is that it reduces the number of direct changes to your theme's Liquid files. This can potentially make future theme updates smoother, as you're less likely to encounter conflicts with updated Liquid code from Shopify.
Implementing the CSS-Only Solution
Open Assets > base.css and paste this code at the bottom of the file:
/* cart and search buttons -> text */
.header__icon--search, .header__icon--cart {
width: auto;
text-decoration: none;
text-transform: uppercase;
margin: 0;
}
:is(.header__icon--search, .header__icon--cart):hover {
transform:scale(1.05);
}
.header__icons {
padding-right: 0;
gap: 5px;
}
/* cart */
.header__icon--cart .svg-wrapper {
display: none;
}
.header__icon--cart .svg-wrapper + .visually-hidden {
visibility: visible;
position: relative !important;
width: auto;
clip: unset;
}
.header__icon--cart .cart-count-bubble {
position: static;
margin-left: 5px;
width: auto;
color: inherit;
background: none;
font-size: inherit;
line-height: inherit;
text-decoration:none;
}
.cart-count-bubble:before {
content: "(";
}
.cart-count-bubble:after {
content: ")";
}
/* search */
.icon-search {
display: none;
}
.header__icon--search .svg-wrapper {
width: auto;
}
.header__icon--search .svg-wrapper:after {
content:"Search"
}
This CSS block works by:
- Hiding the original SVG icons using `display: none;`.
- Making the `visually-hidden` text (which originally provided accessibility for screen readers) visible and styling it.
- Using CSS `content` property (`:before`, `:after`) to inject the "(" and ")" around the cart count and the "Search" text for the search icon.
Alternatively, you could wrap this CSS code in tags and add it within a 'Custom Liquid' section in your theme's footer. This keeps the CSS separate from `base.css` but still applies globally.
Choosing Your Path: Which Solution is Right for You?
- Direct Code & CSS (Solution 1): This method offers maximum control over the exact HTML output. It's ideal if you're comfortable with Liquid and want precise control over the structure, or if the CSS-only approach doesn't achieve the exact look you need due to complex theme styling. Be mindful of potential conflicts during theme updates.
- CSS-Only Approach (Solution 2): This is a less intrusive option for modifying your theme's appearance. It's great if you prefer to keep your Liquid files as close to the original as possible, potentially simplifying future theme updates. However, it relies on the existing HTML structure and might be less flexible for very specific layout changes.
Both solutions are effective for the Dawn theme. Your choice depends on your comfort level with theme code and your long-term maintenance strategy.
Important Considerations & Best Practices
- Mobile Responsiveness: Always test your changes thoroughly on various devices (desktop, tablet, mobile) to ensure the text elements display correctly and don't break your layout.
- Accessibility: While these solutions replace visual icons, ensure the new text is clear and accessible. The original `visually-hidden` spans were for screen readers; if using the direct code approach, ensure your new text is descriptive.
- Testing Thoroughly: After making any code changes, preview your theme extensively. Click on the new text links, check different pages, and ensure all functionality remains intact.
- Future Theme Updates: Remember that any direct modifications to theme files might be overwritten when you update your theme. Always re-duplicate your theme before updates and re-apply your customizations carefully.
Customizing your Shopify store's header with text-based cart and search links is a fantastic way to enhance clarity and align with your brand's unique aesthetic. Whether you opt for direct Liquid modifications or a clever CSS-only approach, these methods provide the flexibility you need.
At Shopping Cart Mover, we specialize in not just seamless migrations but also in advanced Shopify customizations. If you find these code edits daunting or have more complex development needs, don't hesitate to reach out to our expert team. We're here to help you build and maintain a perfectly tailored e-commerce experience!