# Connect Shopify and WhatsApp to Collect Orders via Chatbot

## **Overview**

Start your smooth integration with Shopify by following our detailed guide. Whether you're updating order tags, creating orders, or generating draft orders, this guide walks you through the process of connecting Shopify to your chat flow with ease.

## **Shopify API Key and Secret**

To obtain your Shopify API Key and Secret, follow these steps:

1. Log into your Shopify admin panel and navigate to the **Apps** menu from the left-hand navigation.
2. Scroll down and click on **Develop apps for your store**.
3. Click **Create an App**, enter the app name as "BizMagnets", and then click **Create app**.
4. Once the app is created, go to **API credentials** and scroll down to the **Access tokens** section. Click on **Configure Admin API access**.
5. Select all permissions labeled "Read\_..." and "Write\_..." (if applicable), and then click **Save App** at the bottom of the page.
6. Return to **API credentials** to find the **API Key** and **Secret Key** (Password).

## Connect Shopify

1. To begin, navigate to the Integrations section and click on Shopify.

<figure><img src="/files/JzEbxh0v6nPTAG5ixZCD" alt=""><figcaption></figcaption></figure>

2. Proceed by selecting one of the options, and you will be prompted to either create a new connection or choose from an existing one.
3. If no connection has been made yet, you will need to enter the Connection Name, API Key, Password, and Shopify Subdomain. After entering the required information, click Create to complete the setup.

<figure><img src="/files/3CFdhX2yjDC0OxCjMDed" alt=""><figcaption></figcaption></figure>

## Using the Shopify Connector

Using the Shopify Connector, you can perform the following actions:

<table><thead><tr><th width="215">Action Name	</th><th>Action Description</th></tr></thead><tbody><tr><td>Replace Order Tag</td><td>Update an existing order tag with a new one, allowing for better order categorization or tracking.</td></tr><tr><td>Create Order</td><td>Create a new order in Shopify, capturing customer information, products, and payment details.</td></tr><tr><td>Create Draft Order</td><td>Generate an order on behalf of a customer without requiring immediate payment, enabling you to send an invoice or collect payment later.</td></tr><tr><td>Complete Draft Order</td><td>Finalize a draft order once the customer pays or confirms the details, converting it into a regular order with fulfillment options.</td></tr></tbody></table>

<figure><img src="/files/Qr94gx0Kcn4ftV6aKxoV" alt=""><figcaption></figcaption></figure>

### **Replace Order Tag**

The Replace Order Tag action allows you to update tags on existing orders without the need for manual changes. This is particularly useful for managing sales campaigns, tracking inventory, and improving customer service by keeping order categorization clear and up-to-date.

**How to use this Action:** Select the relevant variables where the Order ID and Tags are stored, or manually enter the information in the designated fields. Once done, click on 'Save' to apply the changes.

<figure><img src="/files/KhPPyBQ7MWFcRM3bxo1n" alt=""><figcaption></figcaption></figure>

### **Create Order** <a href="#create-order" id="create-order"></a>

{% hint style="info" %}
This Action will work for an Order-based chat-flow.
{% endhint %}

**Available Fields for this Action:**

<table><thead><tr><th width="231">Fields	</th><th>Description</th></tr></thead><tbody><tr><td>Name</td><td>Assign a variable that stores the customer’s name. Example: <code>{{customer.first_name}}</code></td></tr><tr><td>Phone</td><td>Assign a variable that stores the customer’s phone number. Example: <code>{{customer.phone_number}}</code></td></tr><tr><td>Financial Status</td><td>Select the order's payment status from the dropdown. Example: "Pending Payment"</td></tr><tr><td>Tag</td><td>Assign a variable for order tags or directly input the tag to be added to the order. Example: "Express Shipping"</td></tr><tr><td>Note</td><td>Assign a variable or input the note to attach to the order. Example: "Urgent delivery requested."</td></tr><tr><td>Source Name</td><td>Identifies the platform where the order originated in Shopify.</td></tr><tr><td>Address</td><td>Customer’s billing address linked to the order in Shopify.</td></tr><tr><td>City</td><td>The city component of the customer’s billing address in Shopify.</td></tr><tr><td>State</td><td>The state or province portion of the customer’s billing address in Shopify.</td></tr><tr><td>Country</td><td>The country portion of the customer’s billing address in Shopify.</td></tr><tr><td>Pin </td><td>The postal code related to the billing address in Shopify.</td></tr><tr><td>Shipping Address</td><td>The customer’s shipping address for the order in Shopify.</td></tr><tr><td>Shipping City</td><td>The city for the customer’s shipping address in Shopify.</td></tr><tr><td>Shipping State</td><td>The state or province for the customer’s shipping address in Shopify.</td></tr><tr><td>Shipping Country</td><td>The country for the customer’s shipping address in Shopify.</td></tr><tr><td>Shipping Pin Code</td><td>The postal code for the customer’s shipping address in Shopify.</td></tr></tbody></table>

After assigning variables for all the required fields, click 'Save' to finalize the action.

<figure><img src="/files/tkGMn2EwkVSWb7BQnc9Y" alt=""><figcaption></figcaption></figure>

### **Create Draft Order**

Draft orders in Shopify offer flexibility for managing orders manually, bypassing the standard checkout process. This feature is useful for orders that require customization or manual handling.

**Available Fields for this Action:**

<table><thead><tr><th width="225"></th><th></th></tr></thead><tbody><tr><td>Name</td><td>Input a variable that stores the customer’s name. Example: <code>{{customer.name}}</code></td></tr><tr><td>Phone</td><td>Input a variable that stores the customer’s phone number. Example: <code>{{customer.phone}}</code></td></tr><tr><td>Draft Order ID</td><td>Enter a variable to store the draft order ID. Example: <code>{{order.draft_order_id}}</code></td></tr><tr><td>Invoice URL</td><td>Enter a variable to store the invoice URL. Example: <code>{{order.invoice_url}}</code></td></tr><tr><td>Financial Status</td><td>Select the order’s payment status from the dropdown. Example: "Pending Payment"</td></tr><tr><td>Discount Type</td><td>Choose between two options: "Percentage" or "Fixed Amount."</td></tr><tr><td>Discount Value</td><td>Enter a value for either the percentage or a fixed discount amount.</td></tr><tr><td>Discount Title</td><td>A short description of the applied discount. Example: "Black Friday Deal"</td></tr><tr><td>Discount Description</td><td>Additional details about the discount. Example: "15% off all electronics"</td></tr><tr><td>Address</td><td>The customer’s billing address linked to the order in Shopify.</td></tr><tr><td>City</td><td>The city section of the customer’s billing address.</td></tr><tr><td>State</td><td>The state or province section of the billing address.</td></tr><tr><td>Country</td><td>The country of the billing address.</td></tr><tr><td>Pin</td><td>The postal code related to the billing address.</td></tr><tr><td>Shipping Address</td><td>The customer’s shipping address for the order.</td></tr><tr><td>Shipping City</td><td>The city portion of the shipping address.</td></tr><tr><td>Shipping State</td><td>The state or province portion of the shipping address.</td></tr><tr><td>Shipping Country</td><td>The country for the shipping address.</td></tr><tr><td>Shipping Pin Code</td><td>The postal code for the shipping address.</td></tr></tbody></table>

{% hint style="info" %}
This Action will create the draft order and send the payment link to the user.
{% endhint %}

After filling in the required fields, click 'Save' to complete the draft order creation.

<figure><img src="/files/Q1N7kedXpZsOnlkYyo0D" alt=""><figcaption></figcaption></figure>

### **Complete Draft Order**

This action finalizes a draft order in Shopify, typically after customer payment or confirmation.

**Available Fields for this Action:**

<table><thead><tr><th width="231"></th><th></th></tr></thead><tbody><tr><td>Draft Order ID</td><td>Enter the variable where the temporary draft order ID is stored, created before the customer confirms payment.</td></tr><tr><td>Payment Pending</td><td>Choose either "True" or "False" to indicate whether payment is still pending for the order.</td></tr><tr><td>Order ID</td><td>Enter the variable where the finalized order ID will be stored in Shopify after the customer confirms payment.</td></tr></tbody></table>

To use this action, select the appropriate variables for Draft Order ID and Order ID, and choose the payment pending status from the dropdown menu. Then, click 'Save' to complete the process.

<figure><img src="/files/R1jOr3Ilz4DKjTADADNt" alt=""><figcaption></figcaption></figure>

All customer details captured through the chat-flow with the Shopify Connector will be automatically pushed to your connected Shopify account.

{% hint style="info" %}
Ensure that the correct variables are assigned as values for all relevant fields.
{% endhint %}

With your Shopify Connector in place, efficiently manage orders and draft orders. Follow the steps in this guide to ensure precise data entry, whether you're updating order tags or creating new orders. Enhance your Shopify integration by assigning the appropriate variables and values, turning your chat-flow into a powerful tool for seamless e-commerce management.


---

# Agent Instructions: 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:

```
GET https://docs.bizmagnets.ai/bot-flows/integrations/connect-shopify-and-whatsapp-to-collect-orders-via-chatbot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
