> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/light-touch-integration/integrate-with-lti/woocommerce.md).

# WooCommerce

ESW Light Touch Integration (LTI) lets you connect ESW services to your WooCommerce storefront.

This integration supports:

* Country Selector
* Dynamic Pricing
* Checkout
  * User Data Sent to Checkout
  * Stored Cards in Checkout
* Returns Integration
* Order Status Synchronization

### Integration overview

{% stepper %}
{% step %}

#### Generate the WooCommerce API keys

Create REST API keys with read and write access.
{% endstep %}

{% step %}

#### Share the credentials with ESW

Provide the consumer key and consumer secret so ESW can complete the setup.
{% endstep %}

{% step %}

#### Install the required plugins

Install the plugins needed for token handling and storefront script loading.
{% endstep %}

{% step %}

#### Configure the token snippet and storefront script

Add the ESW-provided PHP snippet and load the ESW script in your storefront.
{% endstep %}
{% endstepper %}

### Step 1: Generate WooCommerce REST API keys

Generate REST API keys and grant ESW the permissions needed for the integration.

1. Log in to your WordPress admin account.
2. Go to *WooCommerce*.
3. Open *Settings*.
4. Open the *Advanced* tab.
5. Select *REST API*.
6. Click **Add key**.
7. Enter the following values:

| **Parameter** | **Description**               |
| ------------- | ----------------------------- |
| Description   | A label to identify the key   |
| User          | The user who will own the key |
| Permissions   | **Read/Write**                |

8. Click **Generate API key**.
9. Copy and store the **Consumer key** and **Consumer secret**.
10. Share both values with ESW.

{% hint style="warning" %}
You may not be able to view these credentials again later. Store them securely before leaving the page.
{% endhint %}

### Step 2: Install the required plugins

Install the plugins needed for the WooCommerce LTI setup.

Required plugins:

* WooCommerce Blocks
* Insert PHP Code Snippet

Install this plugin only if you are **not** using Elementor:

* Insert Headers and Footers

Use these steps for each plugin:

1. In your WordPress admin dashboard, go to *Plugins > Add New*.
2. Search for the plugin by name.
3. Click **Install Now**.
4. Click **Activate**.

If you cannot find a plugin in search, upload the plugin package and install it manually.

### Step 3: Configure the plugins

After installation, configure the plugins as follows.

#### Configure Insert PHP Code Snippet

Use this plugin to add the ESW-provided PHP snippet. ESW uses it to retrieve cart data and create the preorder flow.

1. In the WordPress admin dashboard, go to *XYZ PHP Code > PHPCode Snippets*.
2. Click **Add New PHP Code Snippet**.
3. Paste the PHP snippet provided by ESW.
4. Name the snippet `woocommerce-token`.
5. Click **Create**.
6. Copy the generated **Snippet Short Code**.
7. Create a new page named **Token**.
8. Add the snippet shortcode to the **Token** page.

#### Configure WooCommerce Blocks

WooCommerce Blocks does not require any extra configuration for this integration.

### Step 4: Add the ESW script to your storefront

Use one of the following methods to load the ESW script URL provided by ESW.

{% tabs %}
{% tab title="Using Elementor" %}

1. In WordPress, go to *Elementor > Custom Code*.
2. Click **Add New**.
3. Paste the ESW-provided script URL.
4. Ensure the script loads in the `<head>` section.
5. Save the changes.
   {% endtab %}

{% tab title="Using Insert Headers and Footers" %}

1. In WordPress, go to *Settings > Insert Headers and Footers*.
2. Paste the ESW-provided script URL.
3. Add it to the *Scripts in Header* section.
4. Save the changes.
   {% endtab %}
   {% endtabs %}

{% hint style="info" %}
You need the ESW-provided PHP snippet and script URL before you can finish the WooCommerce setup. Contact your ESW point of contact if you do not have them yet.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.esw.com/light-touch-integration/integrate-with-lti/woocommerce.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
