Connecting Shopify to Sanity with Webhooks in Vue/Nuxt - Resources?
Great to hear you're loving Sanity! Your setup sounds solid, and you're asking about a really common pattern in the Vue/Nuxt + Shopify ecosystem.
The good news: You don't necessarily need to build webhook handlers from scratch anymore! Sanity Connect for Shopify is the official solution that handles all the webhook complexity for you, and it works with any frontend framework including Nuxt—not just Hydrogen.
How Sanity Connect Works
Sanity Connect is a Shopify app that automatically syncs your products, variants, and collections from Shopify into your Sanity dataset using webhooks behind the scenes. You install it from the Shopify App Store, connect it to your Sanity project, and it handles:
- Automatic bi-directional sync powered by Shopify webhooks
- Real-time updates when products change in Shopify
- Publishing state management (draft products in Shopify = unpublished in Sanity)
- Product data appears under a
storeproperty in your Sanity documents (typically read-only)
This means you can enrich Shopify products with all the rich content capabilities Sanity offers—editorial content, custom modules, media galleries, etc.—while keeping Shopify as the source of truth for product data.
Using It With Nuxt
Once your products are synced to Sanity via Connect, your Nuxt app queries them just like any other Sanity content using GROQ or GraphQL. You'd fetch both the Shopify product data (from the store property) and your custom Sanity content in one query. For the actual cart/checkout functionality, you'd still use the Shopify Storefront API directly from your Nuxt frontend.
The headless commerce guide specifically mentions building with frameworks like Nuxt as a supported approach.
If You Need Custom Webhook Logic
If you need to build custom webhook handlers for specific use cases beyond what Connect provides (like custom business logic, syncing additional data, or triggering specific actions), I'd recommend using Sanity Functions rather than setting up external serverless functions.
Functions are Sanity's built-in serverless compute layer (Node.js v22, 900s timeout, 10GB memory) that's perfect for this because:
- No external hosting needed - runs on Sanity's infrastructure
- Automatic scaling and security
- Native integration with your Sanity project
- Can receive external webhooks from Shopify or other services
- Event-driven - can also trigger on Sanity document changes
You'd define them in a sanity.blueprint.ts file. For webhook verification (like HMAC verification for Shopify webhooks), you'd handle that in your Function code using Node.js crypto utilities—it's the same code you'd write for any serverless function, just deployed to Sanity's infrastructure instead.
Functions are the modern, recommended approach compared to traditional webhooks because they eliminate the need for external hosting while giving you the same capabilities.
Quick Start
For a new project, you can scaffold everything pre-configured:
npm create sanity@latest -- --template shopify --create-project "Shopify Store" --dataset production --typescript --output-path shopify-storeThis gives you a Sanity Studio set up with all the Shopify schemas ready to go. Then install Sanity Connect from the Shopify App Store, and you're syncing!
Resources for Learning More
- Sanity Connect for Shopify docs
- Sanity Functions quickstart (if you need custom webhook handlers)
- Headless ecommerce with Sanity and Shopify guide
Hope this helps clear things up! The Vue/Nuxt community is definitely underserved in e-commerce examples compared to React, but the underlying approach is framework-agnostic once you're using Sanity Connect to handle the sync. Your Nuxt app just queries Sanity like normal and uses the Shopify Storefront API for commerce operations.
Show original thread6 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.