El Webhook de pedido creado es el más común y es utilizado para enviar la información del pedido recien creado en la web a una URL externa (normalmente algún CRM de gestión).

Los Webhooks se configuran desde el panel de gestión de la web, en WooCommerce > Ajustes > Avanzado > Webhooks.

En la siguiente imagen puedes ver un ejemplo de cómo configurar un Webhook.

Con la siguiente configuración lo que hacemos es que cada vez que la web genere un nuevo pedido, envíe toda la infomación de este pedido a la url https://integrations.xxxx.com en formato JSON.

Ejemplo del JSON enviado por el Webhook:

            {
    "id": 6983,
    "parent_id": 0,
    "status": "processing",
    "currency": "EUR",
    "version": "7.7.2",
    "prices_include_tax": false,
    "date_created": "2023-06-16T10:03:15",
    "date_modified": "2023-06-16T10:03:16",
    "discount_total": "25.12",
    "discount_tax": "2.51",
    "shipping_total": "0.00",
    "shipping_tax": "0.00",
    "cart_tax": "0.00",
    "total": "0.00",
    "total_tax": "0.00",
    "customer_id": 5,
    "order_key": "wc_order_6rY9SLwqE0Nxe",
    "billing":
    {
        "first_name": "Team",
        "last_name": "Pomatio",
        "company": "",
        "address_1": "Calle inventada 61",
        "address_2": "3B",
        "city": "San Sebastián",
        "state": "SS",
        "postcode": "20018",
        "country": "ES",
        "email": "team@pomatio.com",
        "phone": "123456789"
    },
    "shipping":
    {
        "first_name": "Team",
        "last_name": "Pomatio",
        "company": "",
        "address_1": "Calle inventada 61",
        "address_2": "3B",
        "city": "San Sebastián",
        "state": "SS",
        "postcode": "20018",
        "country": "ES",
        "phone": ""
    },
    "payment_method": "",
    "payment_method_title": "",
    "transaction_id": "",
    "customer_ip_address": "12.12.123.123",
    "customer_user_agent": "Amazon CloudFront",
    "created_via": "checkout",
    "customer_note": "Mensaje dummy.",
    "date_completed": null,
    "date_paid": "2023-06-16T10:03:16",
    "cart_hash": "1252af68ac2017d0d9e08d0c2f566e91",
    "number": "6983",
    "meta_data": [
    {
        "id": 120582,
        "key": "_billing_nif",
        "value": "12345678a"
    },
    {
        "id": 120621,
        "key": "is_vat_exempt",
        "value": "no"
    },
    {
        "id": 120622,
        "key": "delivery_date_timestamp",
        "value": "1686988983"
    }],
    "line_items": [
    {
        "id": 3296,
        "name": "ANCHOA CANTABRA LATA 120GR",
        "product_id": 4312,
        "variation_id": 0,
        "quantity": 2,
        "tax_class": "tasa-reducida",
        "subtotal": "18.16",
        "subtotal_tax": "1.82",
        "total": "0.00",
        "total_tax": "0.00",
        "taxes": [
        {
            "id": 10,
            "total": "0",
            "subtotal": "1.816"
        }],
        "meta_data": [],
        "sku": "23168442",
        "price": 0,
        "image":
        {
            "id": "4932",
            "src": "https://ejemplo.com/wp-content/uploads/2022/12/23168442.png"
        },
        "parent_name": null
    },
    {
        "id": 3297,
        "name": "AGUA SIERRA NATURA PET 1.5 CJ 6 UD",
        "product_id": 4284,
        "variation_id": 0,
        "quantity": 4,
        "tax_class": "tasa-reducida",
        "subtotal": "6.96",
        "subtotal_tax": "0.70",
        "total": "0.00",
        "total_tax": "0.00",
        "taxes": [
        {
            "id": 10,
            "total": "0",
            "subtotal": "0.696"
        }],
        "meta_data": [],
        "sku": "22526390",
        "price": 0,
        "image":
        {
            "id": "4922",
            "src": "https://ejemplo.com/wp-content/uploads/2022/12/22526390.png"
        },
        "parent_name": null
    }],
    "tax_lines": [
    {
        "id": 3299,
        "rate_code": "IVA REDUCIDO-1",
        "rate_id": 10,
        "label": "IVA reducido",
        "compound": false,
        "tax_total": "0.00",
        "shipping_tax_total": "0.00",
        "rate_percent": 10,
        "meta_data": []
    }],
    "shipping_lines": [
    {
        "id": 3298,
        "method_title": "Recoger en el local",
        "method_id": "local_pickup",
        "instance_id": "12",
        "total": "0.00",
        "total_tax": "0.00",
        "taxes": [],
        "meta_data": [
        {
            "id": 26044,
            "key": "description",
            "value": "Recoger en local: Calle inventada. L a V 9h a 17:30h y S 9h a 14h",
            "display_key": "description",
            "display_value": "Recoger en local: Calle inventada. L a V 9h a 17:30h y S 9h a 14h"
        },
        {
            "id": 26045,
            "key": "logo",
            "value": "",
            "display_key": "logo",
            "display_value": ""
        },
        {
            "id": 26046,
            "key": "Artículos",
            "value": "ANCHOA CANTABRA × 2, AGUA SIERRA NATURA PET 1.5 CJ 6 UD × 4",
            "display_key": "Artículos",
            "display_value": "ANCHOA CANTABRA × 2, AGUA SIERRA NATURA PET 1.5 CJ 6 UD × 4"
        }]
    }],
    "fee_lines": [],
    "coupon_lines": [
    {
        "id": 3300,
        "code": "qwerty",
        "discount": "25.12",
        "discount_tax": "2.51",
        "meta_data": [
        {
            "id": 26055,
            "key": "coupon_data",
            "value":
            {
                "id": 3827,
                "code": "qwerty",
                "amount": "100",
                "status": "publish",
                "date_created":
                {
                    "date": "2022-05-12 17:35:01.000000",
                    "timezone_type": 3,
                    "timezone": "Europe/Madrid"
                },
                "date_modified":
                {
                    "date": "2022-05-12 17:35:01.000000",
                    "timezone_type": 3,
                    "timezone": "Europe/Madrid"
                },
                "date_expires": null,
                "discount_type": "percent",
                "description": "",
                "usage_count": 1,
                "individual_use": false,
                "product_ids": [],
                "excluded_product_ids": [],
                "usage_limit": 0,
                "usage_limit_per_user": 0,
                "limit_usage_to_x_items": null,
                "free_shipping": true,
                "product_categories": [],
                "excluded_product_categories": [],
                "exclude_sale_items": false,
                "minimum_amount": "",
                "maximum_amount": "",
                "email_restrictions": ["team@pomatio.com"],
                "virtual": false,
                "meta_data": []
            },
            "display_key": "coupon_data",
            "display_value":
            {
                "id": 3827,
                "code": "qwerty",
                "amount": "100",
                "status": "publish",
                "date_created":
                {
                    "date": "2022-05-12 17:35:01.000000",
                    "timezone_type": 3,
                    "timezone": "Europe/Madrid"
                },
                "date_modified":
                {
                    "date": "2022-05-12 17:35:01.000000",
                    "timezone_type": 3,
                    "timezone": "Europe/Madrid"
                },
                "date_expires": null,
                "discount_type": "percent",
                "description": "",
                "usage_count": 1,
                "individual_use": false,
                "product_ids": [],
                "excluded_product_ids": [],
                "usage_limit": 0,
                "usage_limit_per_user": 0,
                "limit_usage_to_x_items": null,
                "free_shipping": true,
                "product_categories": [],
                "excluded_product_categories": [],
                "exclude_sale_items": false,
                "minimum_amount": "",
                "maximum_amount": "",
                "email_restrictions": ["team@pomatio.com"],
                "virtual": false,
                "meta_data": []
            }
        }]
    }],
    "refunds": [],
    "payment_url": "https://ejemplo.com/confirmar-pedido/pagar-pedido/6983/?pay_for_order=true&key=wc_order_1rY2SLwqE0Nxe",
    "is_editable": false,
    "needs_payment": false,
    "needs_processing": true,
    "date_created_gmt": "2023-06-16T08:03:15",
    "date_modified_gmt": "2023-06-16T08:03:16",
    "date_completed_gmt": null,
    "date_paid_gmt": "2023-06-16T08:03:16",
    "lang": "es",
    "currency_symbol": "€",
    "_links":
    {
        "self": [
        {
            "href": "https://ejemplo.com/wp-json/wc/v3/orders/6983"
        }],
        "collection": [
        {
            "href": "https://ejemplo.com/wp-json/wc/v3/orders"
        }],
        "customer": [
        {
            "href": "https://ejemplo.com/wp-json/wc/v3/customers/1"
        }]
    },
    "delivery_date_timestamp": "1686988983"
}
        

*La información de ‘delivery_date_timestamp’ es opcional y solo se añadirá en caso de que el Delivery esté activo en la tienda. El valor es la fecha con hora exacta que el cliente haya decidido que quiere recibir el pedido. El Delivery se puede activar y configurar desde el panel de administración en Ajustes > Theme Options > E-Commerce.