# WooCommerce

:::tip Available
This integration is active and ready to use on all Pro plans.
:::

Connect your WooCommerce store to Frihet. Orders automatically synchronize and generate invoices.

## What is it for?

With WooCommerce integrated:

- **Order Sync** — New orders automatically appear in Frihet
- **Automatic Invoices** — They are created without any action from you
- **Client Data** — Name, email, order address are imported
- **Inventory Control** — Products synchronized between both platforms (optional)

## Requirements

- **WordPress with WooCommerce installed** — Your online store
- **WordPress Access** — Admin user or with plugin permissions
- **Frihet Pro or higher**

## Install connection plugin

### Step 1: Download the plugin

1. In WordPress, go to **Plugins** → **Add New**
2. Search for **"Frihet WooCommerce"**
3. Click **Install**
4. Then **Activate**

Or download it manually from: `frihet.io/plugins/woocommerce`

### Step 2: Authorize the connection

1. In WordPress, go to **Settings** → **Frihet WooCommerce**
2. Click **"Connect with Frihet"**
3. You will be redirected to Frihet
4. Authorize access
5. Automatically redirects to WordPress

### Step 3: Configure what to synchronize

In **Settings** → **Frihet WooCommerce**, choose:

- ✅ **Synchronize orders** — Recommended
- ✅ **Create automatic invoices** — Recommended
- ⚪ **Synchronize clients** — Optional
- ⚪ **Synchronize inventory** — Only if you need it

Save changes.

## How sync works

### New order in WooCommerce

```
1. Client buys from your store
   ↓
2. WooCommerce receives the order
   ↓
3. Plugin detects change
   ↓
4. Sends data to Frihet (in real-time)
   ↓
5. Frihet automatically creates:
   - Client (if new)
   - Invoice with the products from the order
   ↓
6. The invoice appears in your Frihet list
```

### Synchronized data

| Data | From WooCommerce to Frihet |
|------|-------------------------|
| Order number | Invoice number |
| Products | Invoice lines |
| Quantity | Quantity |
| Price | Unit price |
| Client | Name, email, address |
| Order date | Invoice date |
| Order status | Payment status |
| VAT (if configured) | Detailed VAT |

## Order and invoice statuses

### WooCommerce → Frihet

| WooCommerce Status | Frihet Status |
|-------------------|---------------|
| Pending payment | Pending |
| Processing | Pending |
| Completed | Paid ✅ |
| Canceled | Canceled |
| Refund | Partial Refund |

If the client marks the order as "Completed", the invoice is automatically marked as paid.

## Real example

### Client buys from your store

Order in WooCommerce:
```
Order #1234 - 10 Feb 2025
- 2x Product A @ €50 = €100
- 1x Product B @ €30 = €30
Total: €130 + €27,30 VAT (21%) = €157,30

Client: Juan García
Email: juan@example.com
```

### In Frihet automatically

Invoice created:
```
Invoice #1234
Date: 10 Feb 2025
Client: Juan García
- 2x Product A @ €50 = €100
- 1x Product B @ €30 = €30
Subtotal: €130,00
VAT (21%): €27,30
Total: €157,30
Status: Paid ✅
```

The invoice appears in your list. **Without doing anything.**

## Advanced configurations

### Product category mapping

If you want WooCommerce products to be created as products in Frihet:

1. In WordPress, go to **Settings** → **Frihet WooCommerce**
2. Activate **"Synchronize products"**
3. Choose whether to synchronize inventory (stock)

This is useful if you want to reuse those products in future quotes.

### Custom invoice format

By default, Frihet uses its format. You can customize:

1. In **Frihet**, go to **Settings** → **Invoicing**
2. Modify the invoice template
3. New WooCommerce orders use that template

### Email to client

When an invoice is created from WooCommerce:

- ✅ WooCommerce sends order confirmation email
- ✅ Frihet can send invoice email (if you activate it)

Both emails will go to the client. You can deactivate one in Settings to avoid duplicates.

## Test the integration

### Test order

1. Go to your WooCommerce store
2. Place a test order (as a client)
3. In Frihet, go to **Invoicing** → **Invoices**
4. You should see the invoice created automatically in the last 30 seconds

If it doesn't appear:

- Wait 1 minute (sometimes it takes time)
- Verify that WooCommerce → Frihet shows "Connected"
- Check error logs in **Settings** → **Integrations** → **Logs**

## Refunds and cancellations

### Client cancels order in WooCommerce

1. The status changes to "Canceled"
2. Frihet detects the change
3. The invoice is marked as "Canceled"

### Client requests refund

If you process a refund in WooCommerce:

1. It is registered in the order
2. Frihet automatically creates a **credit note** (if you activate it in Settings)
3. Or you can manually create the credit note in Frihet

## Limitations

Frihet → WooCommerce:

- **Does not synchronize invoices from Frihet to WooCommerce** — Only WooCommerce → Frihet
- **Edits in Frihet do not affect WooCommerce** — If you change the price of an invoice in Frihet, WooCommerce is not updated
- **New products in Frihet do not go to WooCommerce** — Only existing ones are synchronized

## Troubleshooting

### "I don't see WooCommerce invoices in Frihet"

- Verify that the integration is connected ✅
- The order must be in "Processing" status or higher
- Wait 1-2 minutes after creating the order
- Reload Frihet (F5)

### "Why are emails duplicated?"

- WooCommerce sends order email
- Frihet can also send invoice email
- Solution: Deactivate Frihet emails for WooCommerce orders in **Settings** → **Email**

### "The client does not match between WooCommerce and Frihet"

- WooCommerce created a new client in Frihet
- If the client already existed, they might have been duplicated
- Solution: Manually merge clients in Frihet

### "Can I disconnect without losing invoices?"

Yes. Already created invoices remain in Frihet. Disconnection only:

- Stops new syncs
- New orders in WooCommerce are no longer synchronized

To disconnect:

1. Go to **Settings** → **Integrations**
2. Search for **WooCommerce**
3. Click **Disconnect**
4. Confirm

:::tip Webhooks for e-commerce
Frihet emits [webhooks](/desarrolladores/webhooks) on events like `invoice.created` and `invoice.paid`. Use it to synchronize your WooCommerce store with external systems or trigger automations when invoices are generated from orders.
:::

## Next steps

- [Connect Shopify if you also have a store there](./shopify)
- [Automate flows with n8n](./n8n)

---

**Previous:** [Stripe Connect](./stripe-connect)
