WooCommerce Subscriptions Export: Data Scope, CSV Workflows and Safe Migration Checks
Performing a clean woocommerce subscriptions export requires understanding which records are essential, which are sensitive, and how to move recurring billing logic safely. This guide explains what subscription fields to include, practical CSV and API workflows, step-by-step migration checks, trade-offs, and common pitfalls—emphasizing backups, staging, permissions, testing, privacy and rollback strategies.
Overview: Why Subscription Exports Require Care
Subscriptions are more than orders: they contain schedules, billing intervals, payment tokens, retry rules, and links to customer and order records. A naïve CSV export may omit schedule metadata or expose gateway tokens. For documentation on the Subscriptions extension and behaviors to preserve, consult the official WooCommerce Subscriptions documentation at https://docs.woocommerce.com/document/subscriptions/ and use the REST API reference at https://developer.wordpress.org/rest-api/ for programmatic exports.
Data Scope: What To Export and What To Protect
Identify the minimum viable dataset to reconstitute subscriptions on the target site while protecting sensitive values.
- Essential fields: subscription_id, customer_id (or email), product_sku, start_date, next_payment_date, billing_period, billing_interval, status, recurring_total, tax, currency, last_order_id, parent_order_id.
- Schedule and meta: trial_end, end_date (if applicable), expiry, linked renewal orders, applied coupons, and custom meta keys required by business logic.
- Do not export raw gateway tokens: Payment tokens, card PAN data, and sensitive gateway responses must be treated per PCI rules. Most gateways do not allow token export; instead plan to reattach tokens via the gateway or request customers to re-enter payment methods.
- Privacy and consent: Only include personally identifiable information (PII) if you have consent and a legal basis. Mask or exclude unnecessary PII when possible.
Common Export Workflows
Choose an approach based on technical skill, data size, and hosting limitations.
1. Official REST API Export
Use the Subscriptions REST endpoints or the WooCommerce REST API to export subscription objects. This method is robust for filtered exports and supports pagination. Advantages: precise field selection, avoid exposing tokens. Disadvantages: requires API credentials with appropriate permissions and may be rate-limited by hosts.
2. CSV Export via Plugin or Extension
CSV is familiar for migration teams and business users. Use a reputable export plugin or an official tool that can export subscription meta and linked orders. Ensure the exporter handles serialized meta correctly. Advantages: easy to review in spreadsheets. Disadvantages: large files, character-encoding, host file-size limits, and potential omission of meta fields unless mapped explicitly.
3. Direct Database Export (SQL)
When you control the server and need exact fidelity, export subscription rows and related meta directly from wp_posts, wp_postmeta, wp_users, and wp_woocommerce_order_items. Advantages: complete fidelity. Disadvantages: requires SQL expertise, risk of exposing sensitive fields, and more complex mapping during import.
4. WP-CLI or Custom Scripts
For large stores or automated migrations, WP-CLI scripts or custom PHP scripts that use WordPress functions preserve serialized data and reduce memory issues. Ensure the hosting provider permits command-line access.
Step-by-Step Safe Migration Checklist
- Back Up Everything: Take full database and file-system backups and verify restore procedures. Store backups off-site where allowed.
- Prepare a Staging Site: Perform exports and imports on a staging environment that mirrors PHP, MySQL, and plugin versions to detect incompatibilities.
- Verify Permissions and Limits: Check host-imposed upload limits, max_execution_time, memory_limit, DB user privileges, and whether shell access or WP-CLI is available.
- Export with an Audit Log: Include export timestamps and checksums. Split CSVs if files exceed host limits and compress with verified integrity.
- Sanitize Sensitive Fields: Redact or remove gateway tokens. If token migration is required, coordinate with the payment gateway—consult gateway vendor documentation for token portability.
- Import to Staging and Rebuild Links: Import subscriptions, then re-associate customers and orders. Recreate schedules and ensure cron or Action Scheduler workers are enabled.
- Run End-to-End Tests: Test renewal flows, invoice generation, failed payment retries, webhook processing, and email notifications. Use test cards with the gateway in sandbox mode where possible.
- Obtain Customer Consent If Required: If migration changes how PII or payment methods are stored, notify customers and collect consent as required by law or policy.
- Schedule a Controlled Cutover: Consider a maintenance window to minimize out-of-sync renewals. Notify customers of any brief service interruption.
- Have A Rollback Plan: Keep backups and an automated way to restore the original database if reconciliation fails.
Trade-Offs and Decision Points
- Accuracy vs Simplicity: Direct DB exports preserve everything but require careful mapping; CSV is easier but may lose serialized meta.
- Token Portability: If you cannot migrate payment tokens, you must either prompt customers to re-enter details or use gateway-specific token migration processes (if offered).
- Downtime vs Risk: Live migrations reduce downtime but raise the risk of missed renewals. A short maintenance window reduces risk but inconveniences customers.
- Host Limitations: Shared hosts may block long-running imports or large uploads—plan chunked imports or use WP-CLI where available.
Troubleshooting and Common Pitfalls
- Missing Meta: If renewal behavior differs after import, check for missing postmeta keys. Use the REST API or SQL to verify meta counts.
- Payment Failures: If renewals fail because tokens are invalid or absent, coordinate with your gateway or notify customers to update payment methods.
- Duplicate Subscriptions: Ensure imports check for existing subscription IDs or use mapping logic to avoid creating duplicates.
- Action Scheduler/Crons Not Running: Confirm scheduled tasks run on the target host; many subscription events rely on Action Scheduler.
- File Size, Memory, Timeouts: Use chunked imports or CLI methods to avoid PHP timeouts and memory exhaustion on hosts with strict limits.
Conclusion
A successful woocommerce subscriptions export and migration balances fidelity, privacy, and operational risk. Use the REST API or vetted CSV workflows, sanitize payment tokens, test thoroughly on staging, verify host capabilities, and keep a clear rollback plan. When in doubt, coordinate with your payment gateway and hosting provider and follow the official WooCommerce Subscriptions documentation at https://docs.woocommerce.com/document/subscriptions/ for behavior specifics.







