我正在尝试将 WooCommerce webhook 配置为仅在订单完成时触发,目的地是 Make (Integromat) 应用程序。
当我将“Topic”字段设置为“Order created”(图 1)时,在 Make 端我得到一个漂亮而长的 JSON,其中包含订单的所有字段,但在这种情况下,未完成的订单也可以过滤英寸
图一:
此配置的 JSON 结果:
[
{
"id": 19970,
"parent_id": 0,
"status": "completed",
"currency": "USD",
"version": "7.4.1",
"prices_include_tax": true,
"date_created": "2023-03-06T16:15:24",
"date_modified": "2023-03-06T16:19:26",
"discount_total": "51.11",
"discount_tax": "8.69",
"shipping_total": "0.00",
"shipping_tax": "0.00",
"cart_tax": "78.20",
"total": "538.20",
"total_tax": "78.20",
"customer_id": 0,
"order_key": "",
"billing": {
"first_name": "AAA",
"last_name": "BBB",
"company": "CCC",
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"postcode": "",
"country": "",
"email": "",
"phone": "5555"
},
"shipping": {
"first_name": "",
"last_name": "",
"company": "",
"address_1": "",
"address_2": "",
"city": "",
"state": "",
"postcode": "",
"country": "",
"phone": ""
},
"payment_method": "",
"payment_method_title": "",
"transaction_id": "",
"customer_ip_address": "",
"customer_user_agent": "",
"created_via": "admin",
"customer_note": "",
"date_completed": "2023-03-06T16:19:26",
"date_paid": "2023-03-06T16:19:26",
"cart_hash": "",
"number": "19970",
"meta_data": [],
"line_items": [
{
"id": 3765,
"name": "HHH",
"product_id": 12593,
"variation_id": 0,
"quantity": 2,
"tax_class": "",
"subtotal": "511.11",
"subtotal_tax": "86.89",
"total": "460.00",
"total_tax": "78.20",
"taxes": [
{
"id": 1,
"total": "78.2",
"subtotal": "86.888889"
}
],
"meta_data": [],
"sku": "",
"price": 230.0000005,
"image": {
"id": "15020",
"src": ""
},
"parent_name": null
}
],
"tax_lines": [
{
"id": 3766,
"rate_code": "",
"rate_id": 1,
"label": "",
"compound": false,
"tax_total": "78.20",
"shipping_tax_total": "0.00",
"rate_percent": 17,
"meta_data": []
}
],
"shipping_lines": [],
"fee_lines": [],
"coupon_lines": [
{
"id": 3767,
"code": "",
"discount": "51.111111",
"discount_tax": "8.688889",
"meta_data": [
{
"id": 29014,
"key": "coupon_data",
"value": {
"id": 18884,
"code": "",
"amount": "10",
"status": "publish",
"date_created": {
"date": "2021-10-15 15:41:55.000000",
"timezone_type": 3,
"timezone": ""
},
"date_modified": {
"date": "2021-10-15 15:41:55.000000",
"timezone_type": 3,
"timezone": ""
},
"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": false,
"product_categories": [],
"excluded_product_categories": [],
"exclude_sale_items": false,
"minimum_amount": "",
"maximum_amount": "",
"email_restrictions": [],
"virtual": false,
"meta_data": []
},
"display_key": "coupon_data",
"display_value": {
"id": 18884,
"code": "",
"amount": "10",
"status": "publish",
"date_created": {
"date": "2021-10-15 15:41:55.000000",
"timezone_type": 3,
"timezone": ""
},
"date_modified": {
"date": "2021-10-15 15:41:55.000000",
"timezone_type": 3,
"timezone": ""
},
"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": false,
"product_categories": [],
"excluded_product_categories": [],
"exclude_sale_items": false,
"minimum_amount": "",
"maximum_amount": "",
"email_restrictions": [],
"virtual": false,
"meta_data": []
}
}
]
}
],
"refunds": [],
"payment_url": "",
"is_editable": false,
"needs_payment": false,
"needs_processing": false,
"date_created_gmt": "2023-03-06T14:15:24",
"date_modified_gmt": "2023-03-06T14:19:26",
"date_completed_gmt": "2023-03-06T14:19:26",
"date_paid_gmt": "2023-03-06T14:19:26",
"currency_symbol": "$",
"_links": {
"self": [
{
""
}
],
"collection": [
{
""
}
]
}
}
]
我还尝试将“主题”设置为“操作”,然后在“操作事件”中设置为“woocommerce_order_status_completed”(图 2),但是使用此配置我没有得到良好的 JSON 结果:
图二
JSON 结果:
[
{
"action": "woocommerce_order_status_completed",
"arg": 19980
}
]
知道如何仅在订单完成但结果为完整 JSON 时触发吗?