Photos onto WooCommerce products by SKU or name
Flying Pigs Pro can put your photos straight onto your WooCommerce products as they upload. Name each photo after its product's SKU or name, switch on one option, and drop the photos. Each one joins its product the moment it lands: the product image first, then the gallery in order. There is no image list to write and no second import.
Every WooCommerce product can carry a SKU, the unique identifier WooCommerce uses to find and track it. Name each photo after it and the photo finds its product. A product without a SKU can be matched by its name instead. For giving your products SKUs and renaming a folder of camera files quickly, see Naming product photos by SKU or name.
1. Create the products first
The SKU is looked up as each photo arrives, so the products must exist before you upload. The easiest way: import your products with WooCommerce's CSV importer, with a SKU on every product and no image column at all. They will show the grey placeholder until the photos land.
2. Name the photos after their SKUs or names
TSHIRT-001.jpg or TSHIRT-001.0.jpg | the product image of SKU TSHIRT-001 |
TSHIRT-001.1.jpg, TSHIRT-001.2.jpg … | its gallery, in that order |
TSHIRT-001-1.jpg, TSHIRT-001-2.jpg … | also its gallery (the dash style) |
Easton Catcher Helmet.jpg, Easton Catcher Helmet (1).jpg … | the same, by the product's name |
- The number can follow a dot, a dash, an underscore or a space, or sit in brackets:
TSHIRT-001 (2).jpg. Numbers up to 999 work. The lowest number is the product image, so File Explorer's(1)works as it is. Finder and File Explorer can rename a whole folder this way in one pass; see Naming product photos by SKU or name. - The whole file name is always tried as a SKU first, so SKUs that end in a number, or contain a dot, match as they are.
- Upper and lower case do not matter:
tshirt-001.jpgfinds TSHIRT-001. - The SKU always comes first. Only when no SKU matches is the file name compared with product names, with case, spaces, dashes and punctuation ignored and nothing fuzzier:
Louisville-Slugger-Meta-Bat-32.jpgfinds "Louisville Slugger Meta Bat 32". - If two products share a name, or a SKU (a CSV import can leave duplicate SKUs), the photo goes on neither. It lists under Duplicate in the file list's status menu, and its row says how to fix it.
- JPEG, PNG, WebP and the other image types all work the same way.
3. Switch on the option and upload
- On Media > Flying Pigs Uploader, switch on Attach to WooCommerce products by SKU in the run options. The option shows only while WooCommerce is active.
- If you use a folder plugin, pick the folder the photos should go in.
- Drop the photos, or a whole folder of them, and press Start upload.
The option stays on for your later runs until you switch it off. It is saved with your WordPress user.
What you see
- Each row in the file list says what its photo was attached to, for example Product TSHIRT-001: product image or gallery.
- The summary card counts it up: WooCommerce: 558 photos attached to 93 products by SKU. 0 had no product with a matching SKU.
- In the Media Library, each photo shows its product under "Uploaded to", the way WooCommerce's own editor leaves it.
Variations
Name a photo after a variation's SKU and it becomes that variation's image. A variation has one image, so give each variation one photo.
Products that already have photos
- A photo named for the product image (
TSHIRT-001.jpg,TSHIRT-001.0.jpgorTSHIRT-001-1.jpg) becomes the product image. The image that was there moves to the front of the gallery, so nothing is lost. - Numbered photos join the gallery in their order. Pictures that were already in the gallery stay, after the new ones.
- Uploading the same photos again with Overwrite existing files on replaces them in place and changes nothing on the product. Without Overwrite, they are added again as new photos.
Photos the pig could not place
The pig never guesses between products. A photo it cannot place still uploads to the Media Library as normal, the summary card counts it in amber, and its row says how to fix it. Two entries in the file list's status menu pick them out:
- No product: no product has that SKU or name. Check the name against the product, or create the product first.
- Duplicate: more than one product has that SKU or name. Give each product its own SKU under Products, or name the photo after the right product's SKU.
Then drop the same photos again with Overwrite existing files on. Each photo replaces itself in place and joins its product this time; photos already on their product stay as they are. If the photo's name was the problem, rename it and upload it again, then delete the misnamed copy from the Media Library, or attach the photo to the product by hand.
Good to know
- WebP only (Pro, on by default) stores the photos as
.webp. That changes nothing here, since the SKU match ignores the extension. If you ever list images in a product CSV, name them.webp. - To change photos later, for a sale banner or a better picture, re-upload the same names with Overwrite existing files on. They are replaced in place, and the products keep showing them. See Using the watermark maker for a sale mark on and off again.
- The WordPress way, uploading on the Media page and then filling an image column in a second import, still works. Flying Pigs does both jobs in one pass.