E-commerce 8 min read

How to automate order statuses between your e-shop, warehouse and carrier with n8n

I describe the whole chain from a new order to the customer message, including the two places where this kind of integration most often breaks: an outage on the receiving side and waiting for the carrier's response.

How to automate order statuses between your e-shop, warehouse and carrier with n8n
Author: Maksym Kamenchuk, Nexflow — Banská Bystrica Published Updated

An event in the e-shop can be used as a trigger. The e-shop sends a webhook (a notification about an event sent to a given address) to n8n, the workflow calls the warehouse or carrier system through an HTTP request and processes data from the response, for example the tracking number.

WooCommerce has its own webhooks and order statuses. Shoptet has order statuses with status e-mails and an add-on for automatic status switching. Errors in n8n are caught by a separate workflow that sends you an alert.

What the order chain consists of

From the customer's point of view it is one order. Technically it is three systems that all have to know about it equally: the e-shop, the warehouse and the carrier. Manual work appears wherever someone retypes data between them.

  1. The customer creates an order and the e-shop assigns it a status.
  2. The e-shop sends a notification to n8n.
  3. n8n passes the order to the warehouse.
  4. n8n creates a shipment with the carrier and obtains the tracking number.
  5. The tracking number is stored where you need it, and the order status is updated.
  6. The customer receives a shipping notification.

The specific APIs of the warehouse, carrier and e-shop differ. The principle is the same: send data, receive a response, store it. Whether and how a value can be written back into the order depends on the API of the particular e-shop. The exact shape of requests must always be found in the provider's documentation.

Order statuses in WooCommerce and Shoptet

First you need to know which statuses the e-shop has, because the workflow hooks onto them. In WooCommerce every order has a status that determines where it is in the process of payment, fulfilment, cancellation or refund.

WooCommerce statusWhat it means according to the documentation
Pending paymentorder received, payment not yet made
Processingpayment received, stock reduced, order awaiting fulfilment
On holdawaiting payment confirmation, stock is reduced
Completedorder fulfilled, no further action needed
Failedpayment failed or was declined
Cancelledcancelled by an administrator or the customer
Refundedorder value fully refunded after payment

For the warehouse I recommend watching the Processing status, that is, paid and awaiting fulfilment. According to the WooCommerce documentation, stock is already reduced in it.

Shoptet has the system statuses Vybavená (Completed), Vybavuje sa (In progress), Nevybavená (Not completed) and Stornovaná (Cancelled), which cannot be deleted. A new order gets the status marked as default. A status e-mail that is sent on change can also be tied to a status, as can documents created during the transition. Details are in Shoptet support.

If Shoptet already sends a status e-mail when the status changes, don't add a second message with the same content in n8n. The customer would receive two.

How an order triggers a workflow in n8n

WooCommerce can send automatic notifications about events to an address of your choice. For orders the topics are order.created, order.updated and order.deleted, as stated in the REST API documentation. Which topic catches a status change, test on a test order when setting up the webhook.

In n8n this address is created by the Webhook node. It is a trigger node that can start a workflow. It has two addresses: a test one, which is registered when you manually listen for a test event, and a production one, which is registered once the workflow is published.

I write about connecting Shoptet in more detail in the article Shoptet and n8n: integration via API and webhooks, and for WooCommerce in the article E-shop automation with n8n.

Passing to the warehouse and creating a shipment

Communication with the warehouse and carrier is handled by the HTTP Request node. According to the n8n documentation, it can be used to query any app or service with a REST API. The available methods are DELETE, GET, HEAD, OPTIONS, PATCH, POST and PUT.

  1. Passing to the warehouse: POST with the order data to the address of the warehouse system.
  2. Creating the shipment: POST to the carrier's API with the address and parcel parameters.
  3. Processing the response: the workflow extracts the tracking number from the carrier's response.
  4. Storing the value: the principle is the same, the number is sent by another request to where you need it. Exactly how depends on your e-shop's API.
  5. Notifying the customer: a message with the tracking number.

If you use Balíkobot or another supported service, the Shoptet add-on for order automation can connect via API keys and also create rules from shipment tracking data. For a simple case this may be enough without your own workflow.

Waiting for the carrier: where the mistake is made

The natural idea is a workflow that creates the shipment, goes to sleep and wakes up when the carrier sends a status change. According to a discussion in the n8n community, however, the Wait node has no fixed address you could set when waiting for a webhook. At runtime it generates its own address for each execution, available as {{$execution.resumeUrl}}.

An explanation from the same discussion: the address contains the identifier of the specific running execution, and n8n has to know which execution to resume. So there is no single fixed address you could give the carrier.

I recommend splitting it. One workflow creates the shipment and records its number. The other has a Webhook node with a fixed path that you give the carrier, and on every status change received it looks up the order and processes it. This is the same approach the discussion mentioned above suggests.

Errors and outages

WooCommerce automatically disables a webhook after more than five consecutive failed deliveries. Any response other than 2xx, 301 or 302 counts as a failure, including 4xx and 5xx. In my judgment this means that if n8n does not respond during a longer outage, new orders may stop arriving in the workflow without anyone noticing.

In n8n you can set an error workflow for each workflow. It runs when an execution fails and can send an e-mail or a Slack message. It must start with an Error Trigger node.

I recommend checking in the WooCommerce admin from time to time whether the webhook is still active. The error workflow is an n8n tool, so in my judgment it will not cover the webhook being disabled on the e-shop side.

When it doesn't pay off

How to think about return on investment is described in the article How to calculate the return on automation. My work starts at €390; details are in the article How much does AI automation cost.

Frequently asked questions

How does n8n find out that an order has changed?

WooCommerce can send a webhook to the address of the Webhook node in n8n; for orders it has the topics order.created, order.updated and order.deleted. Which of them suits a status change, check on a test order. For Shoptet the procedure is described in the article on integration via API and webhooks.

Can I rely on no order falling through the cracks?

Not without checking. WooCommerce disables a webhook after more than five consecutive failed deliveries. That is why I recommend an error workflow in n8n and checking from time to time that the webhook is active.

Can the Wait node be used to wait for the carrier's response?

According to a discussion in the n8n community, the Wait node generates a new resume address for each execution, so it has no fixed address you could give the carrier. The same discussion suggests a separate workflow with a Webhook node and a fixed path.

Is the webhook in n8n secured?

The Webhook node supports Basic auth, Header auth and JWT auth. In addition, WooCommerce can sign the request body with a secret key via HMAC-SHA256 so the recipient can verify authenticity.

Is an add-on enough for statuses in Shoptet instead of n8n?

For simple rules it can be. According to the add-on description, it checks orders roughly every 5 to 10 minutes and switches statuses according to rules. It costs a connection fee plus credits.

Sources

Related services

ServiceE-commerce automation Servicen8n automation

Related articles

E-commerceShoptet and n8n: API and Webhook Integration E-commerceE-shop Automation with n8n: WooCommerce Webhooks PaybackHow to calculate the payback of automation + calculator

Want to know if it pays off in your e-shop?

Tell me which e-shop, warehouse and carrier you use. We'll go through what can be connected and what is better left manual.

I want a free consultation →