Add WooCommerce Orders to Airtable
This is a simple Autocode app which shows you how to use WooCommerce's webhook feature to automatically add data about orders to Airtable. You can modify this code for when a different action occurs (for example, adding a new product or modifying a coupon code), or to do a different action (eg: send a message to Slack).
Frequently Asked Questions
You will need:
- A Wordpress.org site running WooCommerce
- A free Airtable account
Setting up your Airtable Base
We've created a template Base you can duplicate to quickly get started with this app. Once everything is setup, you're welcome to modify your copy of the Base to better suit your needs. Please note that if you change the titles of any columns then you'll need to also change them in the code of this App.
- Visit this link, and sign into Airtable if you haven't already
WooCommerce Demo in the top corner. Then click the
... icon. Then click
- In the modal that pops up, click the workspace that you'd like to duplicate the base into, then click
If you get an error like in the screenshot below, where you're told
No Workspace Available, click here then click the
Add Workspace button. Once the workspace has been created, head back to the
WooCommerce Demo base, refresh the page, and try again!
- Once your base has finished duplicating, you'll be automatically taken to your Airtable dashboard. Click your duplicated base to open it.
- Okay, last step! We'll need our Base's ID later in this setup process, so let's note it down for safe keeping. When you've got your base open in Airtable, your Base's ID is the characters that begin with
app that are between the first two slashes in the URL. In the example below, the Base ID is
app2ikABFSvrnCZUZ. Note yours down for safe keeping!
Setting up the Autocode App
Once everything is setup in Airtable, we can jump into setting things up on Autocode.
- Scroll up on this page and click the
Install Free button.
- Choose the organization you'd like to install this App into, give it a name, then click
- Paste the Airtable Base ID we saved earlier into the form field, then click
- Once the App finishes installing, click the red
1 Required button in the bottom left of the editor. This will link our Airtable account with Autocode.
- Click the blue
- Click the blue
Link New Resource button.
- Follow the instructions that the link process provides. Once you've finished following them, you'll see that we now have a
1 Linked message in the botton corner. This means everything is setup correctly!
Setting up WooCommerce
Awesome - we've setup everything we need on Autocode and Airtable to make this work! Our last step is telling WooCommerce to send new purchase events to Autocode.
- Login to your WordPress control panel. Then, on the sidebar, click the
Settings button under the
WooCommerce sidebar item.
- Inside the settings menu, open the
Advanced tab. Inside that page, click the
Webhooks button, then
- Fill out the form with the following options:
- Name: choose anything that's easy for you to remember - such as "Send purchases to Airtable"
- Status: Active
- Topic: Order Created
- Delivery URL: your Autocode endpoint. If you're not sure where to find this, check the next step.
Once you've filled out these options, click
Save webhook and you're all done!
Finding your Autocode Endpoint URL
To find the URL of your endpoint, open the file in the Autocode editor, then look near the bottom of the editor. The URL will be shown under your code.
Troubleshoot cURL issues
Occasionally you might get an error like the one below.
If you do, there's a simple fix. You'll need to modify your endpoint URL to look like this:
https://[username].api.stdlib.com/[projectname]@[environment]/[path - if applicable]. For example, if your endpoint URL is
https://dev--woocommerce.jacklynbiggin.autocode.gg/, it would become