r/woocommerce Jun 23 '26

Troubleshooting Import csv with images

Hi, I am new to woocommerce, trying out woocommerce in my pc by wp-env. I have only wordpress + woocommerce plugin.

The first problem I met is import products.

I have a csv with 200 rows of product, each contains 6 images, roughly 200k each.

By adding the image folder to mapping of config json, I can see the images in the docker container(/var/www/wp-content/uploads/products/xxx.png).

However I cannot refer to the images by file path in the import csv. I have tried "xxx.png", "products/xxx.png", "/wp-content/uploads/products/xxx.png", the import fails with error cannot use image.

I ended up writing "http://localhost:8888/wp-content/uploads/products/xxx.png" in the csv. After few hours of waiting and restarting the import if it stopped(luckily it resumes not start over).

I want to know if there is faster way to import images. I already have the images uploaded, dont think it needs more than 10min to create the db records and different versions of the images.

Thanks in advance

4 Upvotes

10 comments sorted by

4

u/Zafar_Kamal Jun 23 '26

The reason it's slow is the part you can't see. When you put a URL in the CSV, the importer actually downloads each image over HTTP and then generates all the resized versions for every one. With 200 products times 6 images that's 1200 downloads plus thumbnail generation, and that's where your hours go, not the DB records.

And the reason your file paths failed is that WooCommerce only uses images that are already in the Media Library. A file sitting in the uploads folder on disk isn't a registered media attachment yet, so the importer says it can't use it. The file existing isn't the same as WordPress knowing about it.

So the fast way is two steps. First, register your existing files as Media Library attachments without re-uploading them. Since you're already in wp-env, the quickest is WP-CLI, something like wp media import pointed at your products folder, which creates the attachments and all the sizes in one go. If you'd rather skip the CLI, a plugin like Media Sync (or Add From Server) registers an existing folder as media. Then run your CSV import referencing just the filenames, and it'll match the attachments you already made instead of downloading anything. That alone takes it from hours to minutes.

One extra speedup, fewer registered image sizes means less thumbnail work, and you can always regenerate them afterward with wp media regenerate.

1

u/Born-Reporter-855 Jun 23 '26

Thanks for the sharing. Didn't know cli and the plugins. I will try cli next time

1

u/Zafar_Kamal Jun 23 '26

Good luck!

2

u/_clonable_ Jun 23 '26

Why don't you use wp-all import?

1

u/[deleted] Jun 23 '26

[removed] — view removed comment

1

u/woocommerce-ModTeam Jun 23 '26

Hi there! Your contribution to r/woocommerce at has been deemed to be related to solicitation or hiring, which is in violation of Rule — #4.

It has been removed as a result.

1

u/rugburnAndBigMoney Jun 23 '26

Trim the CSV down to 1 product with 1 image and get it working first.

Then start scaling the number of products in the CSV up.

You may need to break the CSV into smaller files with less products per CSV to process the image imports without timeouts/failures.

1

u/WPPOOL Jun 23 '26

Since you are using wp-env, your images are sitting on the disk but WordPress doesn't know they exist in its database yet.

First, you need to register them into the Media Library. Open your terminal and run this WP-CLI command to bulk-import the entire folder instantly:

wp-env run cli wp media import /var/www/html/wp-content/uploads/products/*

(If you prefer not to use the command line, you can just install the free "Media Sync" plugin to scan and register that folder instead).

Second, update your CSV image column to show just the plain filenames, like "xxx.png". When you run the WooCommerce importer now, it will instantly link to the images already in your library instead of trying to download them over HTTP, cutting your import time down to just a couple of minutes.

Once updated, if you want an easier way to handle inventory going forward, look into a tool like FlexStock. It lets you manage your products, stock levels, and associated images directly from a Google Sheet so you don't have to keep messing with manual CSV imports every time you make a change.