Skip to content

Choose which cookie categories to allow.

CICO Media
Find image usage

How to See Which WooCommerce Product Uses an Image

Find the product that uses an image as its featured image, in a gallery or in a variation, by hand and with CICO Media Pro, before you replace or delete the file.

By CICO Media4 min read

On this page

A supplier sends a new photo and you want to replace the old file. Or you are cleaning up and one image looks unused. Before you touch it, you need to know which products use it. WooCommerce does not tell you. This article shows how to find out.

The short answer

WooCommerce saves product images as attachment IDs in the product meta. The Uploaded to column shows a product only if you uploaded the image from inside it. To find every product that uses an image, search the product meta for the image ID, or use a tool that keeps a usage index.

Where a product keeps its images

  • Featured image. One ID, saved in the thumbnail meta of the product.
  • Gallery. A list of IDs separated by commas, saved in a single meta value.
  • Variations. Each variation is its own post, with its own thumbnail meta. It points to the product through its parent.
  • Category images. Saved in the term meta of the category, not in a product.
  • Descriptions. An image pasted into the long or short description is in the post content, as HTML.

How to find the products by hand

Back up first. You need the image ID: open the image in the Media Library. The address bar shows it as item=123 in the grid view, or as post=123 on the edit screen.

  1. Search the product meta. Replace wp_ with your table prefix and 123 with the image ID.

    SELECT post_id, meta_key
    FROM wp_postmeta
    WHERE (meta_key = '_thumbnail_id' AND meta_value = '123')
       OR (meta_key = '_product_image_gallery'
           AND (meta_value = '123'
             OR meta_value LIKE '123,%'
             OR meta_value LIKE '%,123'
             OR meta_value LIKE '%,123,%'));

    The four LIKE lines make sure 123 does not match 1234.

  2. Name the product. The post_id can be a product or a variation. Open it in the admin. For a variation, the parent is the product you want.

  3. Check the categories.

    SELECT term_id
    FROM wp_termmeta
    WHERE meta_key = 'thumbnail_id' AND meta_value = '123';
  4. Search the descriptions for the file name, without the size suffix, in Products.

How CICO Media Pro shortens the check

This is a Pro source. The free CICO Media reads post content, blocks and featured images, so an image used only in a WooCommerce product gallery or variation shows No usage there, and the Usage tab lists this source as active and not read. CICO Media Pro reads it.

CICO Media Pro reads the featured images and galleries of products and variations through the WooCommerce product API and keeps the result in its usage index. The image card shows Used · N. Open it and the Where used panel lists each product, with the source (WooCommerce) and a link to edit it.

The panel also shows the frontend status. An image on an active product is Live. If the product is not published, for example a draft or a private product, CICO can show Not live: the image is referenced, but visitors do not see it. We explain the three states in Used vs Visible.

Where used names the source of each reference, WooCommerce included.

You can also filter the library by source. Open the CICO Filters bar, choose WooCommerce in All sources, and see the images used by products.

Two things to keep in mind:

  • Category images are not covered. Check them on the category screen.
  • No usage found means nothing was found. It is not a promise that an image is safe to delete. CICO never deletes anything for you.

In the docs: what CICO Media detects in Integrations, and how Smart Filters narrow the library.

Summary

  • WooCommerce saves product images as IDs in the product meta. The Media Library does not show the product.
  • By hand: search the thumbnail and gallery meta for the ID, then name the product or its parent. Category images live in the term meta.
  • CICO Media Pro lists the products that use an image, with the source and the frontend status.
  • Back up first. The method for any source is in How to Find Where an Image Is Used in WordPress, and the difference between unattached and unused in Unattached vs Unused Media.

Frequently asked questions

How do I find which WooCommerce product uses an image?

Product images are saved as IDs in the product meta. The featured image is in the thumbnail meta, the gallery is a comma-separated list of IDs. Search the postmeta table for the image ID and open the products you find. A plugin that keeps a usage index can show the products directly.

Does the Uploaded to column show the product?

Only if you uploaded the image from inside that product. An image chosen later from the library stays unattached even when it is the main image of a product.

Where does WooCommerce store a variation image?

Each variation is its own post of type product variation, with the image ID in its own thumbnail meta. The variation points to its parent product.

What about product category images?

A category image is saved in the term meta of the category, not in a product. Check the category screen, or search the termmeta table for the image ID.

Does CICO Media Pro show WooCommerce products?

Yes. CICO Media Pro reads the featured images and galleries of products and variations through the WooCommerce product API, and Where used lists the product and the source. Category images are not part of that detection, so check them by hand.

Get CICO Media Pro