Skip to content
WooCommerce

How to Change WooCommerce Magnifying Glass?

· · 10 min read
How to Change WooCommerce Magnifying Glass

The magnifying glass icon in WooCommerce’s search field is one of those tiny UI elements nobody notices until they want to change it, and then it turns out to be more stubborn than expected. It’s not a WooCommerce setting at all, and it never has been, no matter how many settings tabs you click through hunting for it. It’s usually baked into your theme’s icon font or SVG sprite, which means the fix depends more on your theme than on WooCommerce itself. Here’s how to actually track it down and replace it, using theme settings where they exist, custom CSS where they don’t, and icon libraries like Font Awesome when you want more than a swap.

Why Bother Changing It?

The default search icon works fine for most stores. A few reasons stores still change it: matching a brand’s visual language exactly, replacing a thin, easy-to-miss icon with something more visible on mobile, swapping to a rounded or filled style that matches the rest of a custom icon set, or just personal preference after staring at the same header for two years. Rebrands are the most common trigger, a business updates its logo and color palette, then discovers the search icon is the one leftover piece of the old visual system nobody thought to touch.

None of these are urgent. This is a cosmetic change. But cosmetic changes compound, a header that looks slightly off-brand chips away at trust in ways a shopper can’t always articulate.

Step 1: Find Out What’s Actually Rendering the Icon

Before touching anything, right-click the magnifying glass on your live site and choose Inspect (Chrome) or Inspect Element (Firefox). This opens developer tools with the cursor already pointed at the icon’s HTML. You’re looking for one of three patterns:

  • An <i> tag with a class name like icon-search or fa-search, this means it’s an icon font (Font Awesome, Dashicons, or a theme-bundled font).
  • An <svg> element with a path, this means it’s a scalable vector icon embedded directly in the markup.
  • A CSS background-image property pointing at a .png or .svg file, this means it’s a raster or vector image applied through the stylesheet.

Which one you’re dealing with determines everything downstream. Icon fonts get swapped by changing a CSS content property or class. SVGs get swapped by replacing markup or overriding with a background image. Background images get swapped with a single CSS rule pointing at a new file.

Step 2: Check for Theme Customizer Options First

Modern WooCommerce themes increasingly expose icon controls in the Customizer without requiring any code. Go to Appearance > Customize and look through sections named Header, Search, or Icons. If your theme built this in, you’ll find an icon picker or an upload field right there, and the whole exercise takes thirty seconds.

Not every theme offers this. If yours doesn’t, the customizer route is a dead end and you’ll need one of the CSS-based methods below.

Step 3: Replace It with Custom CSS

If the icon is a background image, this is the most direct fix. Go to Appearance > Customize > Additional CSS and add something like:

.header-search .search-icon {
    background-image: url('your-custom-icon-url.png');
    background-size: cover;
    width: 24px;
    height: 24px;
}

Replace the URL with your uploaded icon’s address (upload it through Media Library first, then copy the file URL from there), and adjust width and height to match your header’s proportions. The exact selector (.header-search .search-icon in this example) will differ by theme, this is where the Inspect step from earlier pays off, since it shows you the real class names in use on your site.

Step 4: Swap in a Font Awesome Icon

If the icon is font-based, Font Awesome is the most common library to reach for since a lot of WooCommerce themes already load it. Check first, some themes include it by default and you just need the right class reference. If yours doesn’t, install a Font Awesome plugin from Plugins > Add New to load the library.

Once it’s available, override the existing icon with a pseudo-element rule:

.header-search .search-icon:before {
    content: "\f002";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

\f002 is Font Awesome’s code for its search glyph. Their site lists the codes for every icon in the free set if you want something other than a standard magnifying glass, a rounded version, a bold version, or an entirely different symbol. Layer on additional styling as needed:

.header-search .search-icon:before {
    font-size: 20px;
    color: #333;
}

Also Read: Can WooCommerce Connect to QuickBooks Online (QBO)?

Step 5: Use a Custom SVG for Sharper Rendering

Icon fonts can look slightly fuzzy at certain sizes, particularly on high-DPI screens where anti-aliasing behaves inconsistently. An SVG avoids that problem entirely since it scales without any resolution loss. Upload your SVG file to the Media Library, grab its URL, and apply it the same way as a background image:

.header-search .search-icon {
    background: url('your-svg-icon-url.svg') no-repeat center;
    background-size: contain;
    width: 24px;
    height: 24px;
}

One catch worth knowing: some hosts and security plugins block SVG uploads by default because SVGs can technically carry embedded scripts. If your upload fails silently, check whether your host or a security plugin like Wordfence is filtering the file type, and if so, allow it specifically for trusted admin uploads rather than disabling the protection site-wide.

A Simpler Option: Just Resize or Recolor the Existing Icon

Not every “change the icon” request actually needs a full replacement. Sometimes the real complaint is that the default icon is too small, too pale, or the wrong color for the header background. If that’s the actual problem, a couple of CSS lines solve it without touching the icon source at all:

.header-search .search-icon {
    font-size: 22px;
    color: #1a1a1a;
    opacity: 1;
}

Try this first before reaching for a full icon swap. It’s less work, less risk of breaking something, and it solves the underlying visibility problem most of the time.

Step 6: Test Across Devices and Browsers

After any of the above, check the result properly. Shrink your browser window or use developer tools’ device emulation to see how the icon scales on smaller screens, an icon sized correctly for a 1920px header can look oversized or misaligned once the header collapses into a mobile hamburger layout. Then check across at least Chrome, Firefox, and Safari, font rendering and SVG support have small but real differences between browsers, especially on older Safari versions.

If you’re using a caching plugin, clear the cache after making CSS changes. A stubbornly unchanged icon after you’ve saved new CSS is very often just a caching layer serving the old stylesheet, not a failed edit.

What to Do If the Icon Still Won’t Change

Occasionally none of the above works because a more specific CSS rule elsewhere is winning the specificity battle. Browser developer tools show you this directly, the Styles panel lists every rule affecting an element and shows which ones are being overridden with strikethrough text. If your new rule shows up crossed out, you need a more specific selector or, as a last resort, !important (use sparingly, it makes future maintenance harder).

Another common blocker: the icon is rendered by JavaScript after page load rather than sitting in the initial HTML. If Inspect shows an empty container that fills in a beat after the page renders, you’re dealing with a script-generated icon, and your fix needs to target whatever generated class or attribute the script applies, not a static selector.

Why the Icon Source Differs by Theme

There’s no single standard for how WooCommerce-compatible themes render this icon, which is exactly why “just change this one CSS class” advice online so often doesn’t work for a given site. A lot of classic WordPress themes pull their search icon from Dashicons, the icon font bundled with WordPress core itself, since it’s already loaded and requires no extra asset. Other themes bundle Font Awesome or their own custom icon font specifically for a more distinctive visual style. Newer block themes built around Full Site Editing often use the core Search block instead of a theme-coded search form entirely, and that block has its own icon settings independent of anything in your theme’s CSS.

This is why the Inspect step at the start of this guide matters so much. Skipping it and copy-pasting a CSS snippet from a forum post written for a different theme is the single most common reason these fixes “don’t work.”

If You’re on a Block Theme: Use the Search Block’s Own Settings

If your site is built with a block theme and you’re using the core Search block anywhere (header pattern, template part), you likely don’t need CSS at all. Select the Search block in the Site Editor or post editor, open the block settings sidebar, and look for the icon toggle under the block’s display options. Depending on the block variation in use, you can switch between an icon-only button, a text button, or no button at all, and some versions expose an icon style choice directly. This is worth checking before writing any custom CSS, since it’s the officially supported path and won’t get overwritten the next time WordPress or your theme updates.

Common Icon Style Choices Worth Considering

If you’re going to the trouble of changing the icon, it’s worth being deliberate about which style you land on rather than grabbing the first search glyph you find. A thin outline icon reads as modern and minimal but can disappear against a busy header background. A filled or bold icon is more visible at small sizes, particularly useful on mobile headers where the icon might only be 18 to 20 pixels wide. Rounded icon sets tend to pair better with rounded typography and soft corners elsewhere in a design, while sharp geometric icons pair better with a more technical or editorial brand feel. Pick one and stay consistent, mixing an outline search icon with a filled cart icon next to it is a small detail that undermines an otherwise polished header.

Do You Need a Developer for This?

For most of the methods above, no. Custom CSS through the Customizer’s Additional CSS panel doesn’t touch any theme files and can’t be broken by a future update overwriting it. It’s genuinely a copy, paste, and adjust job for anyone comfortable poking around browser dev tools for five minutes.

Where it gets harder is the JavaScript-rendered icon case mentioned below, or when a theme’s specificity is aggressive enough that nothing you write in Additional CSS takes effect without !important stacked on !important. At that point, bringing in a developer for twenty minutes is usually faster than fighting a theme’s CSS architecture solo.

Comparing the Methods

MethodNeeds coding?Best when
Theme CustomizerNoYour theme actually offers this option
Custom CSS background imageMinimalIcon is a background-image already
Font Awesome overrideMinimalIcon is font-based and Font Awesome is loaded
Custom SVGMinimalYou want crisp rendering at any size
Resize/recolor onlyMinimalThe icon itself is fine, just too small or faint

Keeping the Change Safe Through Future Updates

However you make this change, protect it the same way you’d protect any customization: don’t edit your active theme’s core files directly. A CSS rule pasted into Appearance > Customize > Additional CSS lives in the database, separate from theme files, and survives theme updates automatically. If you’re editing a stylesheet file directly instead, do it in a child theme, never the parent theme, since a parent theme update will silently overwrite anything you changed there and your custom icon will quietly revert with no warning.

The same logic applies to PHP-based icon swaps. If you’re overriding a template file that outputs the search form markup, copy that file into your child theme’s matching directory structure rather than editing the version inside the plugin or parent theme folder. WooCommerce and most well-built themes are designed around this override pattern specifically so customizations like this one survive updates without a fight.

Frequently Asked Questions

Will changing the search icon affect WooCommerce’s search functionality?

No. You’re only changing the visual glyph, not the underlying form field or search logic. The search box will still submit queries and return results exactly as before.

My theme uses Elementor or Divi for the header. Does this still apply?

Mostly yes, though page builders sometimes expose their own icon picker directly in the header widget settings, which is even easier than custom CSS. Check the widget’s settings panel for an icon field before writing any CSS.

Can I use an animated icon instead of a static one?

Yes, with an animated SVG or a CSS transition on hover/focus states. Keep it subtle, a search icon that spins or bounces aggressively reads as gimmicky rather than polished on most storefronts.

Why does my icon look fine on desktop but broken on mobile?

Most themes apply separate mobile styles or swap the header layout entirely below a breakpoint. Check your CSS for a media query targeting the same selector, your override might only be applying at desktop widths.

I changed the CSS but nothing happened. What am I missing?

Three usual suspects: a caching plugin serving the old stylesheet (clear it), a more specific rule elsewhere winning in the cascade (check the Styles panel in dev tools for strikethrough rules), or the icon actually being rendered by JavaScript after the page loads rather than being present in the static markup (Inspect the live page, not the page source, to see the real rendered DOM).

Is it safe to remove the search icon entirely and just use a text link?

Yes, functionally. Some minimal storefront designs skip the icon and use the word “Search” as a plain text trigger instead. It’s a legitimate design choice, just make sure the clickable area is still large enough to tap comfortably on a touchscreen, a general rule of thumb used across mobile design guidelines is keeping tap targets around 40 to 44 pixels.

Was It Worth the Trouble?

Customizing the WooCommerce magnifying glass icon is a small, low-risk change that can make a header feel intentional rather than default. Whether you change it through theme settings, custom CSS, or an icon library swap, the process is the same three-step loop: find what’s rendering it, override it with the right selector, and test the result everywhere a real customer would see it.

Don’t skip the cross-device check. An icon that looks perfect on your desktop Chrome and breaks entirely on mobile Safari isn’t a finished change, it’s half a change waiting to embarrass you on the device most of your shoppers are actually using.

And if none of this feels worth the hour it takes, that’s a reasonable conclusion too. The default icon does its job. Spend the time instead on something a customer’s purchase decision actually hinges on, checkout friction or product photography, and come back to the icon on a slow afternoon.

Interesting Reads:

Does Stripe Automatically Pay WooCommerce and Printify?

Can You Sell a $5000 Product with WooCommerce?

Where Do You Set Thank You Message in WooCommerce?