# 2. Installation

## Installing the plugin

### Via the Shopware Store

1. Log in to the **Shopware Administration**
2. Navigate to **Extensions → Store**
3. Search for "Sold Count Display" and click **Install**
4. The plugin is downloaded and activated automatically

### Manual installation via ZIP

1. Download the plugin ZIP file
2. In the Administration, navigate to **Extensions → My extensions**
3. Click **Upload extension** and select the ZIP file
4. Once uploaded, the plugin appears in the list — click **Install**
5. Enable the plugin using the toggle switch

## First steps after installation

The plugin is ready to use right after activation. However, sold count badges will only appear once the first aggregation run has completed (scheduled to run once per day by default).

**For immediate results**, trigger the aggregation manually:

```bash
bin/console momo:sold-count:aggregate
```

Once the aggregation finishes, badges will appear on product detail pages and in listings.

## CLI command

The plugin provides a console command for manual aggregation:

```bash
# Run the aggregation
bin/console momo:sold-count:aggregate

# Preview without writing to the database (dry run)
bin/console momo:sold-count:aggregate --dry-run
```

The `--dry-run` flag shows what would be aggregated without making any database changes.

## Notes

* Only orders with status **Completed** or **Paid (partially)** are included in the aggregation
* For products with variants, sales from all variants are rolled up to the parent product
* Changes to the time period filter in the configuration take effect on the next aggregation run
* The daily aggregation run is managed by Shopware's scheduled task system
