Shopify

Connect Shopify with MESA

By default, MESA will automatically connect to the Shopify store that you have installed MESA on and no further action is necessary. 😊

Optional: Connect to an external Shopify store or Shopify Plus API

To connect to an external Shopify store or use a Shopify Plus API, you will need to create a Custom App and enter the app's Access Token into the Shopify Credentials section. Ensure that your Custom App contains API scopes and is installed.

  • External Site Hostname: The beginning part of your Shopify store's URL.
  • Access Token: To find your access token, you can follow these steps.

Most Common Shopify Actions

Add a free product to an order

Reward your customers by adding a free product to their order and the free product will appear on the Shopify order! In the following screenshot, MESA added the Single Candle product to the order after the order was created.

Note: At this time, Shopify currently has a limitation which prevents you from editing or adding products to orders that were imported by third party applications such as Recharge.

This Shopify limitation also applies to orders that are paid for in a currency that is not in your store's base currency. 

Feel free to install MESA's existing templates called Add a Free Product to First Time Customer's Order or Add a Free Product to Orders Over $100. You can modify these templates to your needs.

Note: If you needed any help with editing these existing templates to fit your needs, feel free to reach out to our Customer Success team (contact@theshoppad.com). We will be happy to work with you!

If you wanted to create your own workflow, feel free to follow these steps. Then, as the last step in your workflow, you will want to use MESA's Shopify Add Line Item to Order action.

Setup for Shopify Add Line Item to Order Action

  • Order ID (Required): To locate the Order ID, your workflow will need to contain a Shopify Order Created step before the Shopify Add Line Item to Order step. You will need to use MESA's Token feature, by clicking the {+} icon, which is located to the right of the field. Afterward, MESA will suggest the token for Order ID so you will want to select that.
  • Product to Add (Required): Once you click on the dropdown, MESA will automatically display your store's products. Select the free product that you want to add to the order.
  • Product Variant to Add (Required): Once you click on the dropdown, MESA will automatically display your selected product's variants. Select the variant that you want to add to the order. If your product does not have any variants, select the Default Title variant.
  • Quantity (Required): By default, MESA will automatically input 1 as the quantity. You can input any whole number into the field.
  • Discount line item by: By default, MESA will not discount the product that gets added to the order. To ensure that the customer does not have to pay for the product, select Percentage. Then, for the Discount Amount field, enter 100.
  • Allow Duplicates: By default, MESA will add the product to the order if the order already contains the product.
  • Notify Customer: By default, MESA will automatically notify the customer that their order has been updated. You can select No within this field to not notify the customer.
  • Staff Note: Optional note for your staff members that get added to the order.

Add a tag to an order, product, or customer

If you would like your workflow to add a tag to an order, product, or customer, you can use the following Shopify actions:

  • Order Add Tag: Adds a tag to an order
  • Product Add Tag: Adds a tag to a product
  • Customer Add Tag: Adds a tag to a customer

In the App Configuration section, you will see a Tag field. You can enter any text of the tag that you'd like to add and multiple tags can be separated by commas. With these three actions, MESA will not override any existing tags on the order, product, or customer.

Order Add Tag Action

To locate the Order ID, your workflow will need to contain a Shopify Order Created step before the Shopify Order Add Tag step. You will need to use MESA's Token feature, the {+} icon, which is located to the right of the field. Afterwards, MESA will suggest the token for Order ID so you will want to select that.

Product Add Tag Action

To locate the Product ID, your workflow will need to contain a Shopify Product Retrieve Step or by using an Loop by MESA app before the Shopify Product Add Tag Step. You will need to use MESA's Token feature, by clicking the {+} icon, which is located to the right of the field. Afterwards, MESA will suggest the token for Product ID so you will want to select that.

Customer Add Tag Action

To locate the Customer ID, your workflow will need to contain a Shopify Customer Retrieve Step or Shopify Order Step before the Shopify Customer Add Tag Step. You will need to use MESA's Token feature, by clicking the {+} icon, which is located to the right of the field. Afterwards, MESA will suggest the token for Customer ID so you will want to select that.


Add/update metafield values on an order, draft order, product, or customer

Before using these actions, Metafields will need to be set up on an order, draft order, product, or customer on the Metafields page of your Shopify admin. You can follow this Shopify guide on how to create your meta fields: Metafields.

Here is a screenshot of an example of how a meta field will display on a Shopify order in the Shopify admin.

MESA offers Shopify actions that will add or update the values (i.e. Hello!) of the metafields for an order, draft order, product, or customer.

While creating a workflow on the MESA dashboard, you can select these actions under the Shopify app. Select Set Order Metafield action.

Using the Set Order Metafield action as an example, your workflow will need to contain a Shopify Order Created step before the Shopify Set Order Metafield step.

In the Shopify Set Order Metafield step, you will need to fill in the Order IDKey and Value fields. 

To locate the  Order ID, your workflow will need to contain a Shopify Order Created step before the Shopify Set Order Metafield step. You will need to use MESA's Token feature, the {+} icon, which is located to the right of the field. Afterwards, MESA will suggest the token for Order ID so you will want to select that.

The Key comes from the Metafields page of your Shopify admin. You can fill in whatever value you would like to add. If you would like to add a value from the order's data, you can use MESA's Token feature, the {+} icon, which is located to the right of the field.


Update an order

In this section, we will be going over on how to update an order with a new order note after an order with a specific product is created.

1. You can start building your own workflows by clicking the Create New Workflow button on the My Workflows tab.

2. You will be directed to our Workflow Builder. You will need to select the Shopify app and then the Shopify Order Created trigger.

3. For the second step, select the Built-in Apps tab and then the Loop by MESA app.

4. Next, repeat Step 3 but instead of the Loop, select the Filter by MESA app.

5. Repeat Step 4 but instead of the Filter, select the Shopify Update Order Notes Action.

6. Click on the Loop Step. Then, click on the Token menu icon {+}, next to the field, to select the Shopify Order Created Line Items Token.

7. Click on the Filter Step and find the first field. Click on the Token icon {+}, next to the field, to select the Loop Title Token. The Loop Title token represents your product's title.

8. Make sure the Filter's condition value is set to Equals.

9. In the Filter's bottom field, enter your product's exact title. Capitalization matters in this case.

10. Click on the Shopify Update Order Notes Action and locate the token for the Order ID field. The token would be from your Shopify Order Created Trigger: Shopify Order Created ID

11. In the Note field, you will also want to add your own text. MESA will not override the existing Order Notes.

12. Enable the workflow and complete some of the best practices for MESA. You are good to go now!


Retrieve your Shopify order's information

Obtaining your Shopify order's updated information can be achieved by using MESA's Shopify Retrieve Order step. The Shopify Retrieve Order step is normally used after a Delay by MESA app, to allow changes to be made to the order before MESA retrieves it. The Delay by MESA app only contains information from the previous step.

To locate the Order ID, your workflow will need to contain a Shopify Order Created step before the Shopify Order Retrieve step. You will need to use MESA's Token feature, the {+} icon, which is located to the right of the field. Afterwards, MESA will suggest the token for Order ID so you will want to select that.


Cancel a Shopify order

You may cancel your Shopify order using MESA's Shopify Cancel Order step. The Shopify Cancel Order step can be used in a number of scenarios, typically based on certain characteristics, for example automatically cancelling fraudulent orders.

To locate the Order ID, your workflow will need to contain a Shopify Order Created step before the Shopify Order Cancel step. You will need to use MESA's Token feature, the {+} icon, which is located to the right of the field. Afterwards, MESA will suggest the token for Order ID so you will want to select that.

You can also select the Amount to be refunded (see note below), a Reason, and optionally send an Email to the customer.

Note: Due to a Shopify limitation, including the Amount field when canceling an order with only an authorized payment can result in Shopify not capturing the reason or sending an email. Therefore, Shopify recommends omitting the Amount field if the order only has an authorized transaction.


Troubleshooting

Here is a list of common Shopify errors and common solutions. If you have any questions, please don't hesitate to contact MESA support.

400 Bad Request The request was not understood by the server, generally due to bad syntax or because the Content-Type header was not correctly set to application/json.This status is also returned when the request provides an invalid code parameter during the OAuth token exchange process.
401 Unauthorized The necessary authentication credentials are not present in the request or are incorrect.
Solution: Double-check your credential and replay the automation.
402 Payment Required The requested shop is currently frozen. The shop owner needs to log in to the shop's admin and pay the outstanding balance to unfreeze the shop.
403 Forbidden The server is refusing to respond to the request. This is generally because you have not requested the appropriate scope for this action.
Solution: Double-check your credential and replay the automation.
404 Not Found The requested resource was not found but could be available again in the future.
Solution: Verify that the ID you are passing is correct and exists.
406 Not Acceptable The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.
422 Unprocessable Entity The request body was well-formed but contains semantic errors. A 422 error code can be returned from a variety of scenarios including, but not limited to:

  • Incorrectly formatted input
  • Checking out products that are out of stock
  • Canceling an order that has fulfillments
  • Creating an order with tax lines on both line items and the order
  • Creating a customer without an email or name
  • Creating a product without a title
The response body provides details in the errors or error parameters.

Solution: Check that your configuration is correct and replay the automation.
423 Locked The requested shop is currently locked. Shops are locked if they repeatedly exceed their API request limit, or if there is an issue with the account, such as a detected compromise or fraud risk. Contact Shopify support if your shop is locked.
429 Too Many Requests The request was not accepted because the application has exceeded the rate limit. Learn more about Shopify’s API rate limits.
Solution: Try using a Shopify Custom App MESA credential or replay the automation when there is less activity on your store.
500 Internal Server Error An internal error occurred in Shopify. Please post in the Shopify APIs and SDKs forum so that Shopify staff can investigate.
Solution: Please replay your automation or contact Shopify for their staff to investigate.
501 Not Implemented The requested endpoint is not available on that particular shop, e.g. requesting access to a Shopify Plus–only API on a non-Plus shop. This response may also indicate that this endpoint is reserved for future use.
Solution: Try using a Shopify Custom App MESA credential that has access to Plus-only APIs.
503 Service Unavailable The server is currently unavailable. Check the Shopify status page for reported service outages.
Solution: Replay this automation.
504 Gateway Timeout The request could not complete in time. Shopify waits up to 10 seconds for a response. Try breaking it down in multiple smaller requests.
Solution: Try restructuring your MESA workflow to break it down into smaller parts. Reach out to MESA support if you have any questions.