A product CSV can have the expected columns and still attach a variation to the wrong parent—or leave it unattached. Before moving a large catalogue, check a small set of relationships locally.

This example checks a self-contained file in which every variable parent is included. It does not log in to a store, edit products or perform a migration.

The fixture

There are four data rows: a variable parent, two intended variations, and one repeated variation SKU. One variation points to a parent that is absent from the file.

The expected findings are:

  • Line 4: the referenced parent is absent from this file.
  • Line 5: the SKU was already encountered.

Line numbers include the header. The checker reports the second occurrence of a repeated SKU.

Run the check

This example uses Python's standard library. Save it in a local file and run it with Python 3.10 or later.

import csv import io text = """Type,SKU,Parent variable,TSHIRT, variation,TSHIRT-RED,TSHIRT variation,TSHIRT-BLUE,TSHIRT-MISSING variation,TSHIRT-RED,TSHIRT """ reader = csv.DictReader(io.StringIO(text), strict=True) headers = reader.fieldnames or [] if len(headers) != len(set(headers)): raise ValueError("duplicate headers") if not {"Type", "SKU", "Parent"}.issubset(headers): raise ValueError("missing required headers") rows = list(reader) if any(None in row or any(v is None for v in row.values()) for row in rows): raise ValueError("uneven row width") parents = {row["SKU"] for row in rows if row["Type"] == "variable"} seen = set() issues = [] for line, row in enumerate(rows, 2): sku, parent = row["SKU"], row["Parent"] if sku in seen: issues.append((line, "duplicate_sku")) seen.add(sku) if row["Type"] == "variation": if parent.startswith("id:"): issues.append((line, "id_reference_requires_store_lookup")) elif parent not in parents: issues.append((line, "unknown_parent_in_this_file")) for line, reason in issues: print(f"line {line}: {reason}") assert issues == [(4, "unknown_parent_in_this_file"), (5, "duplicate_sku")] 

Expected output:

line 4: unknown_parent_in_this_file line 5: duplicate_sku 

The final assertion checks the example's expected result. If you change the fixture, update that assertion to describe the changes you intended.

Decide what a reference means

The official WooCommerce CSV guide distinguishes product IDs prefixed with id: from SKU references. This small checker validates SKU references within the supplied file. It explicitly asks for a store lookup when a variation uses an ID reference.

An “unknown parent in this file” is a review item, not proof that a store import will fail. The parent might already exist in the destination store. Export the relevant destination records and compare them before deciding to create or repair anything.

Keep SKU values as strings. Do not convert identifiers to integers: that can discard leading zeros. The example also leaves whitespace and case unchanged; any normalization should follow an agreed identifier policy rather than happen silently.

A staging import is still necessary

This check does not validate attributes, image downloads, prices, stock, plugin-specific fields or existing destination records. It does not migrate customers or orders.

Before a bulk import, use a staging store and a backup. Import one variable product and its expected variations. Check the resulting parent relationship, option names and values, product counts, prices and stock. Review the import log before scaling the batch.

Keep three separate records: the original export, the proposed transformed file and the validation report. That makes it possible to explain which changes were made and rerun the same checks.

Try a broader preflight or request a defined result

USA-1 provides a free browser-side WooCommerce CSV preflight. Check its displayed limits before using it; begin with a synthetic sample.

For a custom review, request a scoped WooCommerce CSV quote. A useful initial brief contains the importer/version, approximate row count, synthetic headers and rows, the observed error, and the intended result. Agree acceptance tests, price, timing and an available payment method before commissioning work.

For separate required-field, unique-key and numeric-range checks, our Tabular Data Quality Checker is listed at 490 Telegram Stars. It is a standalone Python toolkit with English documentation and a Russian quickstart; it does not provide this WooCommerce parent-mapping service. The bot shows the product and price before payment.

Disclosure: USA-1 publishes this tutorial and offers the linked tools and services. The fixture is synthetic. No measured customer outcome or migration success is claimed.