Introducing Shopify webhook filtering and other quality of life changes
TL;DR: Process incoming Shopify webhooks under specific conditions to save on your compute time.
Over the last few weeks, we’ve launched a number of improvements to make it even easier to build Shopify apps, including TOML support, one-click upgrades to the latest Shopify API version, and best of all, Shopify webhook filtering.
Webhook filtering
Filter incoming webhooks from Shopify to prevent them from running actions and eating up your request time. Webhook filters reduce the number of Shopify webhook events that trigger your actions, lowering your total Gadget compute time and monthly costs.
Shopify introduced the option to filter events in the 2024-07 version of their Admin API, and you can now apply those same filters directly to your Gadget actions. You no longer need to subscribe to webhooks you aren't interested in, which means you won’t pay for actions you don't need to run.
Previously, you had to write code to skip actions based on a webhook payload's values, which would still drive up your compute time costs. With the new webhook filtering, Shopify won't even send the webhook unless the filter matches, and Gadget will automatically notify you whether a webhook is registered or not, displaying any errors in your logs.
Filter out the noise
Tell me what you want (what you really, really want)!
When setting up webhook filters in Gadget, you can use the same syntax provided by Shopify to filter based on data triggers.
You can input a filter using Shopify's filter syntax and limit the incoming webhooks. You will need to set up separate filters for model actions and global actions, as well as separate filters for <inline-code>create<inline-code> and <inline-code>update<inline-code> model actions.
Here are some examples of when you may choose to use webhook filters.
You may only want to listen to product webhooks for a single product vendor:
Or, you may want to do the opposite and skip webhooks for a certain vendor:
You can also use filters on child models, such as the price of product variants:
This means that if any product variant on the product webhook payload has a price greater than $10, the webhook will be fired.
You can also combine filter conditions for more complex use cases:
Webhook filters will be applied to the nightly reconciliation syncs because these nightly syncs are meant to catch any changes missed due to dropped or debounced Shopify webhooks. You can read more about that in our docs.
Webhook filters are not applied to Gadget’s historical data sync. This allows developers to pull in the latest data from Shopify as they need it using the in-editor sync button or the sync API. In other words, clicking the sync button will backfill all data from your selected scopes, ignoring any webhook filters.
Modify payloads
In addition to allowing you to filter the webhooks you are subscribed to, Gadget also supports Shopify’s syntax for modifying your webhook payloads.
Entering a comma-separated list of fields will limit webhook payloads to just those fields.
For example, if I only wanted to include a product’s title and description in my product webhooks, I could include the following fields:
You can also include fields across child models, such as the price on a variant:
Shopify always recommends including <inline-code>id<inline-code> and <inline-code>updated_at<inline-code> fields to avoid accidental webhook debounces.
And if you’re using webhook filters and modifying webhook payloads, make sure you include all the fields used for your filters!
TOML support
We’re making it much easier to build Shopify apps and extensions in Gadget with better <inline-code>shopify.app.toml<inline-code> support!
Gadget will now automatically add <inline-code>shopify.app.toml<inline-code> files to your projects, removing the manual step of setting this up yourself. You now automatically get a TOML management strategy for building and deploying Shopify extensions, as a default TOML file will be created with every Shopify project in Gadget. There will be a TOML for every development environment app config and a default TOML for production, allowing for easy deployments with the Shopify CLI.
Gadget will also surface error warnings if something is misconfigured in the TOML that does not match with the Shopify connection, with clear guidance on how to resolve issues.
Previously, to work with the Shopify CLI and Gadget, developers would have to manually create <inline-code>shopify.app.toml<inline-code> files themselves and determine the best way to manage the TOMLs across multiple team members or development environments. This led to confusion and frustration trying to figure out the best way to handle these things and keep apps functioning as intended.
For more details on working with the Shopify CLI and Gadget, check out our docs.
Shopify API version 2025-01
As you might have already guessed from the Winter 2025 Editions (The Boring Edition), the latest Shopify API version doesn’t include any major changes.
You can see a full list of changes in Shopify’s documentation.
As always, upgrading your app to the latest version takes just a few clicks. Gadget will provide an at-a-glance summary to see what API resources are deprecated and updated for your app, so you can see exactly what’s changing. If necessary, you can choose to force a <inline-code>shopifySync.run<inline-code> mutation to backfill any data for your existing records. Details available in the docs.
The previous Shopify API version included the addition of the <inline-code>statusPageURL<inline-code> field on the Shopify Order model. Previously, Gadget would sync Shopify Order models through the REST API, but with the upcoming deprecation we are in the process of changing that. If you run into any errors when upgrading to the latest version, we recommend removing the <inline-code>statusPageURL<inline-code> field, or requesting access to all individual customer fields (name, address, email, phone) via the Protected Customer Data Access form in your Shopify Partner portal.
You can find a detailed list of all previous changes and Shopify API versions in our docs.
If you have any questions or feedback about building Shopify apps, you can join our Discord community to connect with other developers and the Gadget team.