skip to Main Content

I have created a Shopify app which will allow different store owners to download it and to configure different Web-hooks of their choice like “Order Create”, “Order Update” etc…

Each and every Web-hooks are getting configured properly and working fine.

But my issue is “how to know that call to web-hook method is made due to action performed by which of the store”

In sort I wanted to know action performed on which store has triggered web-hook method to be executed.

2

Answers


  1. It’s part of the headers and handshake sent by Shopify to your app.

    Regardless of the type of webhook you get a header X-Shopify-Shop-Domain that contains the permanent-shop.myshopify.com address of the shop. see

    Login or Signup to reply.
  2. Shopify package has a method that allow you to register a handler for each topic

    import Shopify from "@shopify/shopify-api";
    
      Shopify.Webhooks.Registry.addHandler(topic, {
        path: "/webhooks",
        webhookHandler: handler,
      });
    

    The handler arguments have the shop that is called for that webhook

    Here’s an example for product delete handler

    export async function deleteProductHandler(topic: string, shop: string, body: any) {
    ...
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search