Changing the magnifying glass icon in WooCommerce can help you customize your store’s appearance and improve brand consistency. Below are several methods to modify the default magnifying glass icon in WooCommerce.
1. Changing the Icon Using Custom CSS
If you want to quickly change the magnifying glass icon without modifying theme files, you can use custom CSS.
Steps:
-
Identify the class of the magnifying glass icon:
- In WooCommerce, the magnifying glass is usually linked to the
.woocommerce-product-gallery__trigger
class.
- In WooCommerce, the magnifying glass is usually linked to the
-
Add Custom CSS:
- Go to Appearance > Customize > Additional CSS in your WordPress dashboard.
- Add the following CSS code:
- Adjust the
content
,font-size
, andcolor
to your preference.
2. Replacing the Magnifying Glass Icon with an Image
If you want to replace the default WooCommerce zoom icon with an image, follow these steps:
Steps:
-
Upload the new magnifying glass icon to your media library.
-
Find the class of the zoom trigger (
.woocommerce-product-gallery__trigger
). -
Add the following CSS to replace it with an image:
- Replace
'your-image-url.png'
with the URL of your uploaded image. - Adjust
width
andheight
to fit your design.
- Replace
3. Editing WooCommerce Template Files
If you need to make deeper changes, you can modify WooCommerce’s template files.
Steps:
-
Locate the Template File:
- Go to
wp-content/plugins/woocommerce/templates/single-product/product-image.php
.
- Go to
-
Copy the Template File to Your Theme:
- Copy
product-image.php
toyourtheme/woocommerce/single-product/
.
- Copy
-
Modify the Icon in the Code:
- Find the following line:
- Replace it with:
- Replace
'your-image-url.png'
with your custom icon URL.
4. Using a Plugin to Customize the Magnifying Glass Icon
If you prefer not to edit code, you can use a plugin to change the magnifying glass icon easily.
Recommended Plugins:
- WooThumbs for WooCommerce – Allows advanced zoom and image customization.
- YITH WooCommerce Zoom Magnifier – Provides options for customizing zoom effects and icons.
To use these plugins:
- Go to Plugins > Add New in WordPress.
- Search for the plugin name.
- Install and activate the plugin.
- Follow the plugin settings to customize the magnifying glass icon.
Final Thoughts
There are multiple ways to change the WooCommerce magnifying glass icon, depending on your preference:
- For quick changes: Use CSS.
- For a custom image: Use CSS with a background image.
- For deeper modifications: Edit WooCommerce templates.
- For an easy solution: Use a plugin.
Choose the method that best suits your needs and enhance the look of your WooCommerce store!