Connecting a WooCommerce Online Store
To connect a WooCommerce online store, you need three keys. A API key, a secret API key, and a secret webhook key.
?> Tip: Make sure that all 'open' orders in your WooCommerce online store are processed before making the connection. This prevents possible stock discrepancies.
Creating API Keys
The API connection ensures that Stoqflow can communicate with your WooCommerce online store. Think of retrieving orders and product information, updating order status, and so on. Below we show the step-by-step plan for connecting a WooCommerce online store to Stoqflow.
- Log in to your WooCommerce online store
- Navigate to 'WooCommerce' => 'Settings' => 'Advanced'
- Click on 'Rest API'
- Click on 'Add Key'

- Fill in 'Description': Stoqflow
- Choose 'Permissions' for: Read/Write
- You will receive the first two keys

- Note: Do not close this window, you will only see these keys once
- Open Stoqflow in a new tab or window
- Navigate to 'Shops' and add a new shop
- Give the shop a name and choose 'Online store', then choose 'WooCommerce'
- Fill in under 'API configuration' the two generated keys

- API key = customer key, API secret = Customer Secret
- Don't forget to enter the full URL of your online store in 'API endpoint' (including http or https)
- Do not close the Stoqflow window but return to WooCommerce
!> Note: After setting up the API and before setting up the webhooks, try a synchronization of products and orders, in that order. After setting up the API keys, you will see two synchronization buttons under your API settings in Stoqflow.
Adding Webhooks
The webhooks ensure that WooCommerce immediately (real-time) notifies our application of any changes to orders. Without webhooks, Stoqflow will receive updates at fixed times and not in real-time.
First webhook: updated order

- Navigate in WooCommerce to 'WooCommerce' => 'Settings' => 'Advanced' => 'Webhooks'
- Click on 'Add Webhook'
- Fill in the following fields:
- Name: Stoqflow – Order Updated
- Status: Active
- Subject: Order updated (Order updated)
- Delivery URL: https://app.stoqflow.com/webhooks/woocommerce
- Secret: (Leave open for now)
- API version: WP REST API-integration V3
- Click on 'Save Webhook'
- The 'Secret' field will be automatically filled in after saving
- Copy this secret key and return to Stoqflow
- Fill in under 'Webhooks configuration' this shared secret key at 'Secret Key'
- Don't forget to enter the full domain name of your online store in 'Origin' (including http or https)
- Choose which orders you want to retrieve in Stoqflow based on the status filter or an advanced filter (most used is status 'processing')
- Save this configuration in Stoqflow

Second webhook: created order
- Navigate in WooCommerce to 'WooCommerce' => 'Settings' => 'Advanced' => 'Webhooks'
- Click on 'Add Webhook'
- Fill in the following fields:
- Name: Stoqflow – Order Created
- Status: Active
- Subject: Order created (Order created)
- Delivery URL: https://app.stoqflow.com/webhooks/woocommerce
- Secret: Copy here the earlier made secret key from the first webhook
- API version: WP REST API-integration V3
- Click on 'Save Webhook'
Third webhook: deleted order
- Navigate in WooCommerce to 'WooCommerce' => 'Settings' => 'Advanced' => 'Webhooks'
- Click on 'Add Webhook'
- Fill in the following fields:
- Name: Stoqflow – Order Deleted
- Status: Active
- Subject: Order deleted (Order deleted)
- Delivery URL: https://app.stoqflow.com/webhooks/woocommerce
- Secret: Copy here the earlier made secret key from the first webhook
- API version: WP REST API-integration V3
- Click on 'Save Webhook'
Adding Shipping Options
When a sale order with a specific shipping option arrives in the application, a courier is searched with a similar name that offers a shipping method enabled for the shop where the order was made. If such a courier is found, it will be used as the preferred courier for that sale order. Shipping options can be added to WooCommerce by following these steps:
- Navigate in WooCommerce to 'WooCommerce' => 'Settings' => 'Advanced' => 'Webhooks'
- Create one or more 'shipping zones'
- Use the names of the couriers you want to use as 'shipping methods' for the 'shipping zones'

