> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launcherforge.io/llms.txt
> Use this file to discover all available pages before exploring further.

# WooCommerce Integration

> Install the LauncherForge plugin, map products to games, and deliver game keys after orders are paid.

# WooCommerce Integration

The LauncherForge Commerce for WooCommerce plugin connects WooCommerce orders to LauncherForge game-key delivery.

<Info>
  WooCommerce handles checkout, taxes, payment methods, refunds, and customer emails. LauncherForge generates the game key. The plugin joins both systems.
</Info>

## What the plugin does

```text theme={null}
WooCommerce order is paid
        ↓
The plugin identifies LauncherForge-enabled products
        ↓
The plugin requests one key per purchased unit
        ↓
LauncherForge returns each delivery and game key
        ↓
The plugin stores the result in the WooCommerce order
        ↓
WooCommerce includes the key in customer order emails
```

## Requirements

* WordPress with WooCommerce active.
* LauncherForge Commerce for WooCommerce plugin.
* Active Commerce API add-on.
* Complete Commerce API key.
* LauncherForge App ID for every game product.
* CD-Key protection enabled for each mapped game.

## 1. Install the plugin

<Steps>
  <Step title="Open the plugin installer">
    In WordPress, open **Plugins → Add New Plugin → Upload Plugin**.
  </Step>

  <Step title="Upload the ZIP">
    Select `launcherforge-commerce-for-woocommerce.zip`.
  </Step>

  <Step title="Install and activate">
    Install the plugin, then activate it.
  </Step>
</Steps>

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/plugin-upload.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=235bda68d7b576a3c891990c6496e937" alt="Upload the LauncherForge plugin" width="1600" height="900" data-path="images/integrations/woocommerce/plugin-upload.png" />

## 2. Configure the integration

Open:

```text theme={null}
WooCommerce → Settings → Integrations → LauncherForge Commerce
```

Configure:

| Setting            | Value                                       |
| ------------------ | ------------------------------------------- |
| Enable integration | Enabled                                     |
| API base URL       | `https://backend.launcherforge.io/api/v1`   |
| Commerce API key   | Complete secret shown once in LauncherForge |
| Debug logging      | Enable temporarily while testing            |

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/integration-settings.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=8240324a765d41651a883586e9e4f658" alt="Configure LauncherForge Commerce" width="1600" height="900" data-path="images/integrations/woocommerce/integration-settings.png" />

<Warning>
  Do not paste only the visible prefix. A value such as `lf_commerce_live_d122d2cc091f` is not the complete API key.
</Warning>

## 3. Create the WooCommerce product

Open:

```text theme={null}
Products → Add New
```

Recommended configuration:

| Field                  | Value                             |
| ---------------------- | --------------------------------- |
| Product type           | Simple product                    |
| Virtual                | Enabled                           |
| Downloadable           | Not required                      |
| Regular price          | Your game price                   |
| LauncherForge delivery | Enabled                           |
| LauncherForge App ID   | Numeric App ID from LauncherForge |

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/product-basic-settings.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=203f01502a029a4b7f3530e1446b730b" alt="Create a WooCommerce game product" width="1600" height="900" data-path="images/integrations/woocommerce/product-basic-settings.png" />

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/product-launcherforge-fields.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=a900d3deabe3349e3547acc21e0815fc" alt="Map the product to a LauncherForge App ID" width="1600" height="900" data-path="images/integrations/woocommerce/product-launcherforge-fields.png" />

<Note>
  Use the numeric App ID expected by Commerce API. Do not enter the game slug.
</Note>

## 4. Run a manual test

For the clearest manual test:

<Steps>
  <Step title="Create an order">
    Open **WooCommerce → Orders → Add Order**.
  </Step>

  <Step title="Add the buyer email">
    Enter a billing email.
  </Step>

  <Step title="Add the mapped product">
    Add the LauncherForge-enabled WooCommerce product.
  </Step>

  <Step title="Save the order">
    Save the order before changing its final status.
  </Step>

  <Step title="Mark it as Completed">
    Change the order status to **Completed** and save again.
  </Step>
</Steps>

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/order-completed.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=2584fbb4a767bfe4b972216a222126e7" alt="Mark the test order as Completed" width="1600" height="900" data-path="images/integrations/woocommerce/order-completed.png" />

<Warning>
  For manual testing, use **Completed**. In a real checkout, the plugin also listens for WooCommerce payment completion and paid order transitions, but the payment gateway controls the exact order-state flow.
</Warning>

## 5. Verify the result

Open the order and check:

* An order note confirming that LauncherForge generated the key.
* The key displayed under the order item.
* A LauncherForge delivery ID.
* The new key in LauncherForge.

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/order-generated-key.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=8777627233086e4da73fda98811a5b99" alt="Game key inside the WooCommerce order" width="1600" height="900" data-path="images/integrations/woocommerce/order-generated-key.png" />

The customer can also see keys in:

```text theme={null}
My Account → Orders → View
```

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/customer-order-key.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=546d0dcb20ebedd94e6f1ea02e3c242c" alt="Customer order details with the game key" width="1600" height="900" data-path="images/integrations/woocommerce/customer-order-key.png" />

## Email delivery

The LauncherForge backend does not email the buyer for external deliveries.

The WooCommerce plugin adds generated keys to customer order emails using WooCommerce's email system.

This means:

```text theme={null}
LauncherForge backend
→ generates and returns the key

WooCommerce plugin
→ stores the key in the order

WooCommerce
→ sends the customer email
```

<Note>
  Your WordPress installation must be able to send email. For production, configure a reliable WordPress mail transport or SMTP plugin according to your hosting environment.
</Note>

## Quantities

If the customer buys quantity `3`, the plugin requests three keys.

Each unit uses a different idempotency key, so retries do not duplicate licenses.

```text theme={null}
Order 1001, item 72, unit 1 → key 1
Order 1001, item 72, unit 2 → key 2
Order 1001, item 72, unit 3 → key 3
```

## Background processing

The plugin schedules delivery work through WooCommerce Action Scheduler.

Open:

```text theme={null}
WooCommerce → Status → Scheduled Actions
```

Search for:

```text theme={null}
lf_wc_fulfill_order
```

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/scheduled-actions.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=044dc11e44da5f62804c5e310ad6bfa4" alt="LauncherForge scheduled action" width="1600" height="900" data-path="images/integrations/woocommerce/scheduled-actions.png" />

Possible states:

* Pending.
* Complete.
* Failed.

## Retry a failed delivery

Open the order and use:

```text theme={null}
Order actions → Retry LauncherForge key delivery
```

The plugin reuses deterministic idempotency values. Existing successful units are not regenerated.

## Logs

Enable **Debug logging** in the integration settings, then open:

```text theme={null}
WooCommerce → Status → Logs
```

Select the log source:

```text theme={null}
launcherforge-commerce
```

<img src="https://mintcdn.com/launcher-forge/NH6VSyZ-G481NLw_/images/integrations/woocommerce/logs.png?fit=max&auto=format&n=NH6VSyZ-G481NLw_&q=85&s=3442190c9450a2cbf6cac3c8232b3602" alt="LauncherForge WooCommerce logs" width="1600" height="900" data-path="images/integrations/woocommerce/logs.png" />

The plugin does not write the Commerce API key or generated game keys to the technical log.

## Common problems

### No LauncherForge fields appear in the product

Confirm that:

* WooCommerce is active.
* The LauncherForge plugin is active.
* The product is being edited through WooCommerce.

### The order completes but no key appears

Confirm that:

* The integration is enabled.
* The complete API key is saved.
* LauncherForge delivery is enabled on the product.
* The App ID is numeric and correct.
* CD-Key protection is enabled for the game.
* The Commerce API add-on is active.

Then inspect Scheduled Actions and WooCommerce logs.

### `INVALID_COMMERCE_API_KEY`

The saved credential is invalid or contains only the prefix. Regenerate it in LauncherForge and copy the full value.

### `EXTERNAL_GAME_NOT_AVAILABLE`

The App ID is wrong, the game belongs to another workspace, or CD-Key protection is disabled.

## Production checklist

* Use a staging store first.
* Keep debug logging disabled after testing.
* Configure reliable WordPress email delivery.
* Test the real payment gateway in sandbox mode.
* Verify customer email and My Account display.
* Test quantity greater than one.
* Test a repeated status update to confirm no duplicate keys.
* Protect WordPress administrator access.
