Skip to the guide

WooCommerce · Import troubleshooting

WooCommerce import error: "504 Gateway Timeout" and execution time exceeded

A 504 Gateway Timeout or “Maximum execution time exceeded” means the import outlasted a server, proxy or PHP limit. Smaller, variation-safe batches and prepared images reduce the work in each step; no file can guarantee that your hosting completes an import.

Which cause is yours?

What you observeMost likely cause
Large file: the import stops partway with an HTTP 504 (or Cloudflare 524) screen1. Monolithic catalog file exceeds server limits
Progress stalls on rows with several image URLs2. Image downloading & thumbnail generation
Fatal error: "Allowed memory size exhausted" or "Maximum execution time" in the logs3. Low PHP max_execution_time or memory_limit
Tens of thousands of records; the browser tab sleeps or the connection drops4. Very large catalogs

1. Monolithic files: Split into variation-safe batches (target 500 records)

The built-in importer works through the file in a series of short requests from your browser. Each request has to finish within the limits of PHP and of every proxy in front of your site; a slow request (many images, a busy database, a slow host) ends with a 504, or a 524 behind Cloudflare. Smaller files mean fewer rows at risk and an easier retry.

The danger of manual splitting: If you cut a large CSV into files by row count in a spreadsheet, a variable parent can end up at the bottom of one file and part of its variations at the top of the next. If the first file then stops halfway, you are left with a product that has only some of its variations.

Fix: Split the catalog into files targeting 500 records each, with every parent and all of its variations in the same file. A product family larger than 500 records is never cut: it stays whole in one larger file of its own. Import the files in order (the names below are those CatalogDock gives the batches of a file called catalog.csv):

  • batches/catalog.part-001.csv — complete product families, parents before their variations;
  • batches/catalog.part-002.csv — the next complete families (a family over 500 records gets a file of its own);
  • IMPORT-ORDER.txt — the order to import the files in, and what to check after each one.

Fixed automatically

The full result of a check includes import batches of about 500 records; a product group is never split.

Reported for you to decide

Problems that would make a batch fail anyway: missing parents, duplicate SKUs, file problems.

Needs data from your store

Server limits, image downloads and plugins of your store. No file split can guarantee a timeout-free import; batches reduce the risk and make a retry easier.

2. Image downloading: The biggest hidden bottleneck

For an image URL in the Images column, WooCommerce downloads the file from the remote server during the import, and WordPress then creates the resized copies (thumbnails) that your theme and WooCommerce register. Both happen inside the import requests, so a few rows with several large remote images can take longer than the server allows.

Fix options:

  • Add the images to the Media Library first: upload them via Media → Add New (or wp media import on the server), then put their file names into the Images column. WooCommerce looks a file name up in the Media Library; a file copied to wp-content/uploads/ by FTP alone is not registered there and is not found.
  • Use fast, direct image URLs: see product images not importing for share links and blocked downloads.

3. Increase PHP max_execution_time and memory_limit

If your host lets you change PHP settings (control panel, php.ini or .user.ini), higher limits can help for the duration of a large import. Values are examples; your host may cap them.

Example PHP settings for a bulk import
; .user.ini or php.ini, only if your host lets you set them (ask before changing a managed host)
max_execution_time = 300
memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 64M

A php_value line in .htaccess only works when PHP runs as an Apache module; on PHP-FPM or CGI hosting it causes an Internal Server Error. If you do not know how PHP runs on your host, use its control panel or ask support. On managed hosts the proxy timeout in front of PHP (for example Nginx fastcgi_read_timeout) may be shorter than max_execution_time, so smaller batches remain the safer step.

4. Very large catalogs and WP-CLI

WP-CLI has no built-in command to import a WooCommerce product CSV: the wc product commands list, create, get, update and delete single products. Do not rely on a command such as wp wc product import; it is not part of WooCommerce. Third-party import plugins may add their own CLI commands: follow their documentation.

For tens of thousands of records through Products → Import, use batches, keep the tab in the foreground until each file finishes, and start with a staging copy of your store.

Still failing?

Split large catalogs into variation-safe batches automatically

Drop your CSV or Excel file into CatalogDock. The free in-browser check shows how your catalog splits into batches (a target of 500 records, never separating parents from their variations) before anything is downloaded.

Runs in your browser · No files uploaded · Never connects to your store

Applies to the built-in WooCommerce CSV importer (Products → Import); importer behavior as in WooCommerce 11.1.2 (on WordPress 7.1.2). Server limits differ between hosts: treat every number as an example.