Codeinwp / Codeinwp/woocommerce-product-addon

Add wp ppom export/import WP-CLI commands for site migration

Open
#554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

doc-needed medium new feature
Dominant language
PHP
Stars
15
Forks
9
Avg merge
3d 17h
Merged PRs (30d)
16

Description

Problem

PPOM stores field configurations in a custom nm_personalized table that standard WP migration tools may not export. Users deactivating during site migration lose their PPOM configurations. Two users in one batch left specifically during migration (candlemakers.co.za, kwaaiplanks.co.za).

Solution

New PPOM_CLI_Command class registered as wp ppom:

Export:
wp ppom export [--file=<path>]

  • Exports all field groups from nm_personalized table to JSON
  • Includes product assignments (_product_meta_id post meta)
  • Records plugin version, export date, and source site URL

Import:
wp ppom import <file> [--skip-assignments]

  • Imports field groups from JSON with auto-increment ID remapping
  • Re-assigns to products with remapped IDs
  • --skip-assignments flag for when product IDs differ between environments

Files Affected

  • New: classes/cli.class.php — WP-CLI command class
  • woocommerce-product-addon.php — conditional require when WP_CLI is defined

Acceptance Criteria

  • wp ppom export creates valid JSON with field groups + assignments
  • wp ppom import restores field groups with new auto-increment IDs
  • Product assignments remapped to new IDs
  • --skip-assignments flag skips product reassignment
  • Commands only load when WP_CLI is defined
  • Migration guide documentation published

Priority: Low — affects small number of users during migration
Regression risk: Isolated — CLI-only, no web impact

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in woocommerce-product-addon.php to trace conditional loading when WP_CLI is defined, then inspect the nm_personalized table and _product_meta_id assignments described in the issue. Use classes/cli.class.php as the implementation entry point and verify export/import, ID remapping, skip behavior, conditional loading, and migration-guide documentation against the acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
cli, database, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.