# `mix phoenix_kit_ecommerce.deduplicate_products`
[🔗](https://github.com/BeamLabEU/phoenix_kit_ecommerce/blob/v0.1.8/lib/phoenix_kit_ecommerce/mix_tasks/phoenix_kit_ecommerce.deduplicate_products.ex#L1)

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
