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:
- Finds products with duplicate en-US slugs (or default language)
- Keeps the product with the lowest ID (oldest)
- Merges localized fields from duplicates into the kept product
- Updates related cart_items and order_items references
- Deletes duplicate products
Usage
mix shop.deduplicate_products
mix shop.deduplicate_products --dry-run
mix shop.deduplicate_products --language es-ESOptions
--dry-run- Show what would be done without making changes--language- Language to check for duplicates (default: en-US)--verbose- Show detailed progress