How to Change the WooCommerce Magnifying Glass Icon

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:

  1. Identify the class of the magnifying glass icon:

    • In WooCommerce, the magnifying glass is usually linked to the .woocommerce-product-gallery__triggerclass.
  2. Add Custom CSS:

    • Go to Appearance > Customize > Additional CSS in your WordPress dashboard.
    • Add the following CSS code:
    css
    .woocommerce-product-gallery__trigger::before {
    content: "\f002"; /* Unicode for Font Awesome search icon */
    font-family: "FontAwesome"; /* Use Font Awesome if available */
    font-size: 20px; /* Adjust size */
    color: #ff6600; /* Change color */
    }
    • Adjust the content, font-size, and color 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:

  1. Upload the new magnifying glass icon to your media library.

  2. Find the class of the zoom trigger (.woocommerce-product-gallery__trigger).

  3. Add the following CSS to replace it with an image:

    css
    .woocommerce-product-gallery__trigger {
    background: url('your-image-url.png') no-repeat center;
    background-size: contain;
    width: 30px;
    height: 30px;
    }
    • Replace 'your-image-url.png' with the URL of your uploaded image.
    • Adjust width and height to fit your design.

3. Editing WooCommerce Template Files

If you need to make deeper changes, you can modify WooCommerce’s template files.

Steps:

  1. Locate the Template File:

    • Go to wp-content/plugins/woocommerce/templates/single-product/product-image.php.
  2. Copy the Template File to Your Theme:

    • Copy product-image.php to yourtheme/woocommerce/single-product/.
  3. Modify the Icon in the Code:

    • Find the following line:
    php
    <a href="#" class="woocommerce-product-gallery__trigger">
    • Replace it with:
    php
    <a href="#" class="woocommerce-product-gallery__trigger">
    <img src="your-image-url.png" alt="Zoom">
    </a>
    • Replace 'your-image-url.png' with your custom icon URL.
See also  Where do you set thank you message in woocommerce ?

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:

  1. Go to Plugins > Add New in WordPress.
  2. Search for the plugin name.
  3. Install and activate the plugin.
  4. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *