mix shop.deduplicate_products (phoenix_kit v1.7.71)

Copy Markdown View Source

Finds and merges duplicate products by slug.

After V47 migration converted slug to JSONB, products can have duplicates where multiple records share the same slug value in a specific language.

This task:

  1. Finds products with duplicate en-US slugs (or default language)
  2. Keeps the product with the lowest ID (oldest)
  3. Merges localized fields from duplicates into the kept product
  4. Updates related cart_items and order_items references
  5. Deletes duplicate products

Usage

mix shop.deduplicate_products
mix shop.deduplicate_products --dry-run
mix shop.deduplicate_products --language es-ES

Options

  • --dry-run - Show what would be done without making changes
  • --language - Language to check for duplicates (default: en-US)
  • --verbose - Show detailed progress