# Shopify

With Shopify connected, the agent recognises a customer from the number they call from, reads back their recent orders and order status, answers questions about your products, quotes your shipping rates and, if you allow it, creates an order or an unpaid draft order for you to review. **Integrations - Catalogue - Shopify - Connect** opens the connect dialog. One connection is shared by every agent in the company.

  <ShotPlaceholder
    src="/assets/integrations/shopify.png"
    name="shopify-connect"
    alt="Connect Shopify dialog with Shop domain and Install via Shopify, and the access token form below"
    capture="Connect Shopify dialog."
  />

## What you need before you start

The dialog offers two ways in. Use the first unless you have a reason not to.

- **Install via Shopify (recommended).** You only need the shop's `myshopify.com` domain and a Shopify login that can install apps. Shopify shows its own approval screen; nothing has to be created in the store first.
- **Access token.** For stores that prefer a custom app. In the store admin open **Settings - Apps and sales channels - Develop apps**, click **Allow legacy custom app development**, then **Create an app** (name it `Voice Logica`). Under **Configuration - Admin API integration - Configure** enable `read_customers`, `write_customers`, `read_orders`, `write_orders`, `read_products`, `write_products` and `read_shipping` (needed when the agent creates delivery orders), then **Save**. On **API credentials** click **Install app** and copy the **Admin API access token** (`shpat_…`). Shopify shows the token only once.

Create the custom app in the store admin, not in the Shopify Dev Dashboard or Partners dashboard. Those give a Client ID and a `shpss_…` secret, which the token form does not accept.

## What you enter

For **Install via Shopify**:

- **Shop domain** (required) — For example `myshop.myshopify.com`. The part before `.myshopify.com` is enough.
- **Client ID** — Only under **Use your own Shopify app credentials**, when you were asked to connect through your own Shopify app. Leave empty to use the Voice Logica app.
- **Client secret** — Same section. Client ID and Client secret are entered together or not at all.

For the access token form:

- **Shop domain** (required) — The `myshopify.com` domain shown in the admin address.
- **Admin API access token** (required) — The `shpat_…` token from **API credentials**.
- **API secret key** — From the same tab. Lets Shopify notify Voice Logica of store changes; without it the scheduled sync still runs.
- **API version** — Pre-filled. Change it only if Shopify has retired that version.
- **Store name** — Display name for the connection. Optional.

## First setup

1. **Integrations - Catalogue - Shopify - Connect**. Enter the **Shop domain** and click **Install via Shopify**. Approve the app in the Shopify window that opens. If you use a token instead, fill the form, click **Test connection**, then **Connect**.

2. Shopify appears under **Connected**. Customers and products start copying in the background straight away.

3. Open **My Agents**, pick the agent, then **Skills - Tools & Workflows**. Turn on **Shopify** and click **Configure**.

4. Pick the operations. **Identify caller by phone** is on by default. Add **Get orders by customer** and **Search products** for order and product questions. To take orders add **Create order**, **Create draft order** or both (with both, the agent drafts quotes and unconfirmed orders and creates a real order only when the caller commits). Add **List shipping options** or **Pre-load shipping rates into the system prompt**, because Shopify does not calculate shipping on orders created through the API.

5. If the agent can create orders, set **Max order value** and **Max order lines**. Use **Custom order attributes** for extra details the agent must collect; they appear on the Shopify order as order attributes.

6. Click **Save** in the settings window, then **Save** the agent.

7. Call the agent from a phone number saved on a Shopify customer (or use **Try this agent**). Ask "What's the status of my last order?". The agent should greet you by name and read back the order status. Then ask about a product by name.

## What the agent can do

| Job | What happens on the call |
|-----|--------------------------|
| Recognise the caller | Matches the caller's number to a Shopify customer. Can also find a customer by name or email and remember the number for next time. |
| Order questions | Reads the caller's recent orders or a single order: status, items, payment state. **Pre-fetch recent orders on call start** loads the last 10 orders before the agent speaks. |
| Product questions | Searches by title, tag or product type and reads one product's details. |
| Take an order | Quotes shipping rates, then creates an order or an unpaid draft order (no stock reserved, no payment taken) within your limits. |

Customers and products are refreshed daily. On the Shopify card under **Connected**, **Sync now** refreshes them immediately and **Sync to Skroutz** rebuilds the product list the agent searches. Nothing is published to the Skroutz marketplace.

## Troubleshooting

**Test connection fails with the access token**

Check that the token starts with `shpat_` and comes from a custom app created in the store admin. A `shpss_…` value is an app secret from the Dev Dashboard and does not work here. Also check that the **Shop domain** is the `myshopify.com` domain of the same store.

**Install via Shopify does nothing or the window closes without connecting**

The approval screen opens in a new window. Allow pop-ups for the Voice Logica app and try again. Make sure the domain is the `myshopify.com` one, not your public shop address.

**The Shopify card shows Action needed and Reconnect**

The Voice Logica app was uninstalled from the store or its access was revoked. Click **Reconnect** and approve the app again. Until then the agent cannot read customers or orders.

**Orders created by the agent have no shipping line**

Shopify does not add shipping to orders created through the API. Turn on **List shipping options** or **Pre-load shipping rates into the system prompt**. With the token method, the custom app also needs the `read_shipping` scope.

## Next Steps

[Get an integration working](https://docs.voicelogica.ai/integrations/) - company connection, then the agent tool.  
[Tools & Workflows](https://docs.voicelogica.ai/agent-configuration/built-in-tools/) - where the Shopify tool is switched on.  
[WooCommerce](https://docs.voicelogica.ai/integrations/eshops/woocommerce/) - [XML product feed](https://docs.voicelogica.ai/integrations/eshops/xml-feed/) - for stores on other platforms.
