woo2emdash
v0.1.0
Published
Migrate a WooCommerce catalog into EmDash CMS collections
Maintainers
Readme
woo2emdash
Command line tool that copies a WooCommerce catalog into EmDash CMS collections. It reads the store through the WooCommerce REST API with a read-only key and writes through EmDash's documented REST API, so it works against EmDash on Cloudflare or on Node.
Status: pre-release. analyze, schema apply, import and redirects work for products, variations, taxonomy terms and images, including images inside descriptions. Customers, orders and reviews are not in scope yet. The target schema is documented in docs/target-schema.md.
Why
EmDash's built-in WordPress importer keeps titles and body text but drops every product field, and WooCommerce orders are not even in a WordPress export anymore. This tool carries the catalog across with prices, stock, variations, attributes, categories, tags, brands and images intact, into a schema other EmDash tools can rely on.
Requirements
- Node.js 22.16 or later
- A WooCommerce REST API key with Read permission (WooCommerce, Settings, Advanced, REST API)
- An EmDash site. On localhost nothing else is needed. For a remote site, an EmDash API token.
Usage
export WOO_URL=https://shop.example.com
export WOO_CONSUMER_KEY=ck_...
export WOO_CONSUMER_SECRET=cs_...
export EMDASH_URL=http://127.0.0.1:4321
npx woo2emdash analyze # what the store contains
npx woo2emdash analyze --lang en # multilingual stores, one language at a time
npx woo2emdash schema show # the target schema
npx woo2emdash schema apply --dry-run # what would be created in EmDash
npx woo2emdash schema apply # create collections, fields and taxonomies (safe to re-run)
npx woo2emdash import --dry-run --lang en --limit 5 # rehearse on five products, nothing written
npx woo2emdash import --lang en # the real thing, safe to re-runRe-running import updates entries in place. For large stores, --since 2026-09-01 limits a re-run to products WooCommerce modified after that date. Every entry is matched by its WooCommerce ID, images are deduplicated by EmDash, and terms are reused by slug. Published products stay published, everything else is a draft.
After the import, redirects writes a 301 map from every published product's old WooCommerce URL to its EmDash URL, in the EmDash seed redirects format. Pass --pattern /shop/{slug} if your product pages do not live under the collection's URL pattern, and --out redirects.json to write a file.
npx woo2emdash redirects --out redirects.jsonMultilingual stores (WPML, Polylang, WC Multilang) hold one product per language. Import one language per run with --lang, which matches the language prefix in the product's permalink. Terms are created only for the products actually imported, so the other languages' categories and tags stay out. If the EmDash site has locales configured, add --locale fr to store that run's entries and terms under the matching locale. With WC Multilang 1.3.0 or later on the store, the language is read from the product itself, filtering happens server-side, and each language copy is linked to the already imported ones as an EmDash translation. Import the default language first, then the others.
Run woo2emdash --help for every flag.
Development
npm install
npm run typecheck
npm run dev -- analyze # runs the TypeScript source directly
npm run build # emits dist/License
MIT
