# Installazione WooCommerce

## Requisiti

- WordPress con WooCommerce attivo
- PHP 8.1+
- Backend CartRecover AI raggiungibile via HTTPS

## Installazione plugin

1. Scaricare `https://cartrecovery.northlinestudio.it/downloads/cartrecover-ai-woocommerce.zip`.
2. Caricare lo ZIP da WordPress Admin > Plugin > Aggiungi nuovo > Carica plugin.
3. Attivare "CartRecover AI for WooCommerce".
4. Aprire WooCommerce > CartRecover AI.
5. Inserire:
   - Backend API endpoint: `https://tuo-backend.test/api`
   - Shop public key
   - Webhook secret

Su questo dominio, finche Laravel resta servito dalla sottocartella `backend/public`, l'endpoint API e':

```text
https://cartrecovery.northlinestudio.it/backend/public/api
```

## Registrazione shop

Esempio:

```bash
curl -X POST https://tuo-backend.test/api/connectors/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Demo Shop",
    "platform": "woocommerce",
    "domain": "https://shop.test"
  }'
```

La risposta contiene `public_key` e `webhook_secret` da copiare nelle impostazioni plugin.

## Recovery link

Il plugin genera link nel formato:

```text
https://shop.it/?cartrecover_token=TOKEN
```

Quando il cliente apre il link, il plugin ricostruisce il carrello e reindirizza al checkout.
