Skip to main content

Product Import/Export

Overview​

The Import/Export module moves products in and out of a store as CSV or XML. An upload becomes a job; the job is processed in batches, each row validated and written through the WooCommerce product API, with a per-row log. Column mappings can be detected from the file's own headers and saved for reuse.

It is for catalogue migration and bulk maintenance — bringing a supplier feed in, taking a snapshot out, repeating either without re-describing the columns each time.

Availability​

ItemValue
Module keyimport_export
TierPremium
Entitlement keyimport_export
Admin tabimport-export, under Operations
Enabled optionaiowc_module_enabled_import_export (off until turned on)
REST namespaceaiowc/v1

Enabling the module creates the three tables below, seeds the settings row and schedules the cleanup job.

Settings​

Stored in the option row aiowc_ie_settings.

KeyDefaultMeaning
default_formatcsvFormat offered first.
batch_size50Rows processed per batch, by both the job and the process route.
enable_scheduled_importsfalseStored flag. No scheduled-import path reads it in this release.
import_imagestrueWhether an import fetches product images.
update_existingtrueWhether a matching product is updated rather than skipped.
export_fieldsid, name, sku, regular_price, sale_price, stock_quantity, categoriesFields an export includes by default.

Formats and files​

Uploads are accepted with a .csv or .xml extension only; anything else is refused. Exports are written as export-<jobId>-<date>.<format>, again CSV or XML.

How a job runs​

  1. POST /import-export/import uploads the file, validates it, counts its rows and creates a job row holding the format, path, total rows, the column mapping and the options.
  2. POST /import-export/jobs/{id}/process processes one batch of batch_size rows and returns the job's new state.
  3. While the state is still processing, the background job reschedules itself for the next batch. The first batch is driven by the process route.
  4. GET /import-export/jobs/{id} reports progress; GET /import-export/jobs/{id}/logs returns the per-row log; GET /import-export/jobs/{id}/download returns a finished export.

Exports follow the same shape through POST /import-export/export.

Mappings​

POST /import-export/detect-mapping reads a file's headers and proposes a mapping onto product fields. A mapping can be saved, listed and deleted, so the same supplier file can be re-imported without redoing the column work.

Admin screen​

The Import/Export tab runs the whole flow: upload a file, review the detected mapping, start an import or an export, watch the job list, and manage saved mappings and settings.

REST API endpoints​

All routes are on aiowc/v1 and require manage_woocommerce, plus a REST nonce on cookie-authenticated requests. Like the bulk-edit routes, these return their payload directly rather than wrapped in the shared response envelope.

MethodPathPurpose
POST/import-export/importUpload a file and create an import job. The file is sent as file.
POST/import-export/exportCreate an export job.
POST/import-export/detect-mappingPropose a column mapping from a file's headers.
GET/import-export/fieldsThe product fields available to map or export.
GET/import-export/jobsList jobs.
GET/import-export/jobs/{id}Read one job's status and progress.
POST/import-export/jobs/{id}/processProcess the next batch of that job.
GET/import-export/jobs/{id}/logsThe per-row log for that job.
GET/import-export/jobs/{id}/downloadDownload a finished export.
GET/import-export/mappingsList saved mappings.
POST/import-export/mappingsSave a mapping.
DELETE/import-export/mappings/{id}Delete a mapping.
GET/import-export/settingsRead the settings above.
POST/import-export/settingsUpdate the settings above.

None of these routes declare individual arguments; the payloads are read from the JSON body, the query string or the upload.

WooCommerce integration​

The module registers no storefront hook, no shortcode and no block. Products are read and written through the WooCommerce product API, so an import respects WooCommerce's own validation and an export reflects what WooCommerce reports rather than raw database rows.

Database schema​

TableHolds
{prefix}aiowc_import_jobsJobs: type, format, file path, total and processed rows, mapping, options and status.
{prefix}aiowc_import_mappingsSaved column mappings.
{prefix}aiowc_import_logsOne row per processed row, with its outcome.

Background jobs​

HookScheduleWork
aiowc_ie_process_importSingle action, self-repeatingProcesses one import batch, then reschedules itself while the job is still processing.
aiowc_ie_process_exportSingle action, self-repeatingThe same for exports.
aiowc_ie_cleanupDailyDeletes upload and export files older than 7 days, and log rows older than 30 days. Both ages are fixed in the job, not settings.

Entitlement limits​

import_export is an on/off grant. The licence's default entitlement set also carries maxImportsPerMonth and maxExportsPerMonth, both 0 in the unlicensed defaults, but no code in this module reads them — in this release nothing counts or caps runs, and the only bound on a job is batch_size per batch.

Health check​

The module reports a warning when its tables are missing, and otherwise reports that it is functioning normally.