Sync
Webhooks
There is a built method to listen for webhooks sent by Shopify back to your application. These are validated by verifying the HMAC signature Shopify sends on each request against a shared secret.
Webhooks registered through the Admin API — including those created by php artisan shopify:webhooks:register — are signed with your app's Client Secret, not the per-webhook secret shown in Settings > Notifications. Set SHOPIFY_WEBHOOK_SECRET to the same value as SHOPIFY_CLIENT_SECRET. The notification-panel secret only applies to webhooks you create manually in that panel.
Registering Webhooks
Via the Command Line (recommended)
The easiest way to register all webhooks is to run the built-in Artisan command. It will query your Shopify store, skip any that are already registered, and create any that are missing.
php artisan shopify:webhooks:register
In multi-store mode you can target a specific store:
php artisan shopify:webhooks:register --store=uk
If --store is omitted in multi-store mode, the command iterates all configured stores.
The command outputs a table showing the topic, callback URL, and whether each webhook was already registered, newly registered, or failed.
The command requires your Shopify credentials to be configured and your application's APP_URL to be set correctly, so that the callback URLs it generates are publicly accessible.
Via the Shopify Admin
You can also register webhooks manually:
Head to your Shopify admin
Click Settings > Notifications
Scroll down to Webhooks and click Create Webhook
Enter the URL as shown in the sections below.
Leave the type as
JSONand on the latest API.If this is your first webhook, you will be provided a secret which you should add to your .env as
SHOPIFY_WEBHOOK_SECRET. This panel secret only signs webhooks created here in the admin — if you also register webhooks via the Artisan command or Admin API, use your app's Client Secret instead (see the warning at the top of this page).
If you are trying to test any webhooks locally you'll need to use a service like Ngrok to forward your localhost to a secure endpoint.
Webhook Status
The Shopify Control Panel dashboard includes a Webhook Status card that queries your Shopify store and shows which webhooks are registered, whether their callback URLs match what the addon expects, and which topics are missing.
For any missing topics, run php artisan shopify:webhooks:register to create them automatically.
Webhook Endpoints
The following endpoints are registered by the addon. All webhook URLs follow the pattern:
https://YOURSITE/!/shopify/webhook/{resource}/{action}
Topic |
URL |
|---|---|
Collection Create |
|
Collection Update |
|
Collection Delete |
|
Product Create |
|
Product Update |
|
Product Delete |
|
Customer Create |
|
Customer Update |
|
Customer Delete |
|
Order Created |
|
Shopify will send the product update webhook on creation too, so a separate product/create webhook is optional for most setups.
The Order Created webhook scans all line_items and re-fetches the product data for each.
Multi-Store
In multi-store mode, the same webhook URLs are used for all stores. Configure a separate set of webhooks in each Shopify admin pointing to the same Statamic endpoints.
Shopify always sends an X-Shopify-Shop-Domain header with every webhook request. The addon uses this header to:
Identify which store the webhook came from (matched against each store's
urlin config).Verify the HMAC signature using that store's
webhook_secret.Pass the resolved store handle to any import jobs dispatched.
Webhook requests from domains not listed in multi_store.stores are rejected with a 403 response.
Each store's webhook secret must be set individually. See Env Values for the per-store env var pattern (SHOPIFY_STORE_{HANDLE}_WEBHOOK_SECRET). As above, when a store's webhooks are registered via the Admin API, this value is that store's Client Secret (SHOPIFY_STORE_{HANDLE}_CLIENT_SECRET).
Events
Each webhook listener also fires an event you can use to hook into with your own logic based on the payload received.
The available events are:
StatamicRadPack\Shopify\Events\CollectionCreate
StatamicRadPack\Shopify\Events\CollectionDelete
StatamicRadPack\Shopify\Events\CollectionUpdate
StatamicRadPack\Shopify\Events\CustomerCreate
StatamicRadPack\Shopify\Events\CustomerDelete
StatamicRadPack\Shopify\Events\CustomerUpdate
StatamicRadPack\Shopify\Events\ProductCreate
StatamicRadPack\Shopify\Events\ProductDelete
StatamicRadPack\Shopify\Events\ProductUpdate
StatamicRadPack\Shopify\Events\OrderCreate
Each event has one property $data with the payload data decoded to a stdClass.
For import job failures, see ProductImportFailed documented in Importing Data.