Shopify ORDERS_CREATE Webhook on Shopify App's

148 views Asked by At

I used the npm init @shopify/app@latest command to create a Shopify app and attempted to implement a feature that listens for webhooks triggered whenever a new order is created in the shop.

Thus, I navigate to the shopify.server.js file and include the following code within the webhooks property:

ORDERS_CREATE: {
  deliveryMethod: DeliveryMethod.Http,
  callbackUrl: "/webhooks",
  callback: async (topic, shop, body, webhookId) => {
    console.log("--- Order create ---");
    const payload = JSON.parse(body);
    console.log(payload);
    console.log("--- /Order create ---");
  },
},

And ofcourse, I added to this access scopes inside shopify.app.toml:

[access_scopes]
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
scopes = "write_products,read_orders,write_orders"

When I update a product (have a webhook set up for PRODUCTS_UPDATE), I can see the webhook being successfully invoked. However, when I manually create an order in the orders tab of the dashboard, I do not see any corresponding webhook requests. What could be the issue, and how can I address it?

0

There are 0 answers