Skip to content

Automation · Orders and fulfillment

Create a WooCommerce order over WhatsApp for cash on delivery

An AI agent validates the product and creates a real WooCommerce order over WhatsApp, marked for cash on delivery and pending review.

How do I create a WooCommerce order over WhatsApp and mark it for cash on delivery?

A Met connected to WooCommerce finds the product requested over WhatsApp and reads its price and stock. For a variable product, it keeps the parent id with the selected variation id. It then gathers details and addresses, uses predefined shipping and shows a summary. Only after the customer confirms in a new message does it create the order with `payment_method: cod`, the exact label manually supplied by the operation, `status: pending`, `set_paid: false` and `confirmar: true`. It opens the order to review its lines, address, method and final total stored by WooCommerce, still pending review. This marks cash on delivery; it does not prove that the order passed through checkout or that the gateway is enabled for that address.

What starts it

When the customer writes

It does not start from an automated incoming-message trigger. The Met assigned to the channel answers when someone asks about a product or says they want to buy, and keeps the lookup, confirmation and order creation inside that conversation.

Nothing to set up. The Met assigned to that channel picks up the conversation and runs the procedure inside it.

Who runs it

Store sales Met

This is the Met serving the WhatsApp conversation with WooCommerce enabled. It turns a concrete purchase request into an order with the same products, quantities and delivery details the customer just confirmed, without typing them again in the store admin.

Channels: WhatsApp

What you need connected

5 steps · 8 tools

The procedure, step by step

Each step shows the tool that runs. They belong to the real connector: if one of them stopped existing, this page would not build.

  1. 1

    Find the exact product

    The Met searches by name or SKU and does not take the first similar result. When several products match, it shows the choices and asks the customer to select one. It then opens the product to check its type, price, publication and inventory status. A missing price or SKU is not filled in from the conversation; it must exist in the catalog.

  2. 2

    Resolve the variation without inventing stock

    For a simple product it keeps its `product_id`. For a variable product it lists the variations and selects the one matching the confirmed attributes, keeping both the parent's `product_id` and the `variation_id` returned inside that parent. It checks its SKU, price and `stock_status`. If `stock_quantity` is empty, it does not claim how many units remain, and it stops when the requested quantity cannot be supported by the available data. Before writing, the tool fetches that variation inside the parent again and rejects a missing or different pair; this identity check neither reserves nor reassesses units.

  3. 3

    Confirm who receives it and how it ships

    If the email belongs to a registered customer, the Met searches and opens the record to reuse its `customer_id`, but asks for the address again because a stored address may be old. If no record exists, it does not create one: the order remains a guest order with `billing` and `shipping`. The method, title and amount in `shipping_lines` come from a rule your business already defined; the connector does not quote freight or decide coverage. Your operation also supplies the `cod` id and exact visible payment label manually because the connector cannot read the gateway configuration.

  4. 4

    Ask for a new yes and create the pending order

    This flow continues only when the operation has confirmed that catalog prices already include every applicable tax, the shipping line is the final charge, and the order needs no coupons or extra fees. The Met shows items or variations, quantities, subtotals calculated from visible catalog prices, recipient, billing and shipping addresses, the payment id and exact label, and the shipping method, title and final charge. It warns that WooCommerce will determine the final total during creation and that it may differ. The Met then asks for explicit confirmation and ends the turn without writing. Only when the customer says yes in a new message does it call `wc_create_order` with `confirmar: true`, `payment_method: cod`, the label supplied by the operation, `status: pending` and `set_paid: false`. It sends no prices.

  5. 5

    Read what was stored before replying

    With the returned id, the Met opens the order and compares its number, lines, quantities, addresses, shipping, status and payment method with the approved summary. It reads the total stored by WooCommerce, presents it as pending review, and does not claim the customer approved that amount before creation. If the call times out or returns an ambiguous response, it lists recent orders and opens candidates. It reuses an id only for one unambiguous match on the person, products, quantities and addresses. If there is no match, more than one, or any doubt, it hands the case to a person and never repeats creation automatically.

Before you start

What you need ready

The Met solves none of these for you. If one is missing, the automation stops there.

The limits

What this automation does NOT solve

Better said here than discovered halfway through the rollout.

FAQ

Questions about this automation

Yes in the order field: it is created with id `cod`, the exact label manually supplied by the operation, `set_paid: false` and pending status. This does not prove the gateway was available in checkout for that address; the store must verify that separately.

The normal checkout runs the COD gateway and may move the status. This integration creates the order through the REST API and does not run that process, so it explicitly leaves the order pending instead of presenting an unpaid order as operationally reviewed.

It opens the parent product and then lists its variations. The order carries the parent's `product_id` together with the `variation_id` returned inside that product, after the person confirms the attributes. It never derives an id from a product name.

The tool fetches a variation again only to validate that it belongs to the parent product; it does not reassess or reserve units. The Met checks stock during the conversation, but if `stock_quantity` is empty it does not state how many remain, and preparation is the final control.

The Met never creates again automatically. It lists orders from that interval and opens candidates. It only reuses the number for one unambiguous match on buyer, products, quantities and addresses. If there is no match, more than one, or any doubt, it hands the case to a person to avoid a duplicate order.

The customer confirms the items, quantities, visible subtotals and final shipping charge, along with the addresses and payment method. They do not confirm an unknown final total. WooCommerce stores that total during creation and the Met reports it afterward as pending review.

Keep going

Other automations built on the same tools

Want this automation running on your own data?

We will show it to you with your accounts connected, not with a canned demo.