Naming product photos by SKU or name
Flying Pigs Pro puts photos onto WooCommerce products by the product's SKU, or by its name when no SKU matches. This guide covers giving your products SKUs, naming the photos after them, and renaming a folder of camera files quickly. For switching the option on and what you see during a run, see Photos onto WooCommerce products by SKU or name.
1. What a SKU is
A SKU (stock-keeping unit) is the code WooCommerce uses to find and track a product or a variation. WooCommerce describes it in the Inventory section of its product documentation. Each SKU must be unique in your store. It can hold letters, numbers and characters such as a dash, for example TSHIRT-001 or BAT-32-RED.
2. Give every product a SKU
- One product at a time: edit the product, open Product data > Inventory and fill in SKU. A variation has its own SKU field in its settings.
- Many products at once: use WooCommerce's CSV importer under Products > Import, with a SKU column. The importer needs no image column at all; the photos come later.
- Products you already have: export them under Products > Export, fill in the SKU column, and import the file again with "Update existing products" ticked.
Only products with a SKU can receive photos this way. A product with no SKU keeps its images as they are.
3. Name the photos
TSHIRT-001.jpg | the product image |
TSHIRT-001.0.jpg | also the product image |
TSHIRT-001.1.jpg, TSHIRT-001.2.jpg … | the gallery, in that order |
TSHIRT-001-1.jpg, TSHIRT-001_2.jpg, TSHIRT-001 (3).jpg | also the gallery: a dash, an underscore, a space or brackets all work |
- Upper and lower case do not matter.
tshirt-001.jpgfinds TSHIRT-001. - SKUs that end in a number are safe. The whole name is always tried as a SKU first, so
SEA-100.jpgfinds SEA-100, not SEA with photo 100. - A variation's SKU sets that variation's image. Give each variation one photo.
- Numbers run up to 999, and JPEG, PNG and WebP photos all work the same way.
- A SKU with a slash or another character a file name cannot hold cannot be matched by SKU. Name those photos after the product's name instead.
- By name: when no SKU matches, the file name is compared with product names, with case, spaces, dashes and punctuation ignored and nothing fuzzier.
Easton-Catcher-Helmet-Youth-1.jpgfinds "Easton Catcher Helmet, Youth". A SKU or a name two products share matches neither: the photo lists under Duplicate and its row says how to fix it.
4. Rename a folder of camera files quickly
Camera files arrive as IMG_4021.jpg and so on. Put each product's photos in their own folder, in the order you want them, then rename them in one go. Type the product's SKU, or its name if it has no SKU.
- Mac (Finder): select the photos, right-click and choose Rename. Pick Format, then Name and Index, type the SKU followed by a dash as the custom format (
TSHIRT-001-), and start the numbers at 0. The first photo becomes the product image, the rest the gallery. - Windows (File Explorer): select the photos, press F2, type the SKU and press Enter. Windows names them
TSHIRT-001 (1).jpg,TSHIRT-001 (2).jpg…, and Flying Pigs reads those as they are: (1) becomes the product image, the rest the gallery.
5. Check the result
- Each row in the file list says which product its photo joined, and the summary card counts photos, products and photos with no matching SKU.
- To see the photos that found no product, pick No product in the file list's status menu; for photos whose SKU or name more than one product holds, pick Duplicate. Each row says what to fix. Then drop those photos again with Overwrite existing files on.