We are trying to setup a webhook for orders_create that only fires when an order is created without a payment gateway. We usually use orders_paid, but we have an outlier: Orders created using payment terms. We need to receive and export payment terms orders to the ERP before they are paid.
With that in mind I ran the following graphQL query against our store and it returned only the payment terms orders because they don’t have a gateway assigned:
query {
orders(first: 100, query: "NOT gateway:*") {
nodes {
id
name
}
}
}
This works well as does -gateway:*. However when applied to a filter in the orders_create webhook the orders returned in the above query did not trigger the webhook. Here is my webhook definition:
{
"node": {
"id": "gid://shopify/WebhookSubscription/***",
"topic": "ORDERS_CREATE",
"filter": "NOT gateway:*",
"callbackUrl": "https://xxxxx.com/api/webhooks"
}
}
I tried it with the hyphen too and it did not work.
To debug this further I then made an unfiltered orders_create webhook and the payload for payment terms orders did indeed have no gateway assigned, so this is not something wrong with the gateway value at the point the webhook is triggered.
Any help would be much appreciated, we are trying to make sure we receive as few webhooks as possible so would rather not run an unfiltered orders_create webhook and then filter on our servers based on the payload.
Cheers
Luke