Skip to content
Platforms · 5 min read

Web push on Shopify: what works, honestly

Shopify doesn’t let stores host a file at yourstore.com/sw.js, and browsers require exactly that. Here are the options that do work, and what each one costs you in effort.

Updated By the Pusharoo team
In short
  • Web push needs a service worker served from your store’s own domain, at the root.
  • Shopify (like Wix and Squarespace) doesn’t allow uploading a file there.
  • Workaround 1: if your domain runs through Cloudflare, a small Worker route can serve /sw.js.
  • Workaround 2: collect subscribers on a site you control and link to the store.

Why it’s tricky

A service worker only controls pages inside its own path on its own origin. To receive notifications for every page of yourstore.com, the worker must load from yourstore.com/sw.js. Shopify doesn’t let merchants publish a file at that path. App proxies exist, but they live under /apps/…, which limits the worker to those pages only.

Options that work

OptionEffortCoverage
Cloudflare Worker route on yourstore.com/sw.js serving Pusharoo’s file, plus the snippet in theme.liquidMedium (domain must be proxied by Cloudflare)Whole store
Shopify App ProxyHigh (custom app)Only /apps/… pages
Collect on a site you own (blog, landing page) and link to the storeLowThat site’s visitors

Step-by-step notes are in the docs. Before proxying a Shopify domain through Cloudflare, check Shopify’s current guidance on third-party proxies for custom domains.

Adding the snippet in Shopify

Online Store → Themes → Edit code → theme.liquid, paste the Pusharoo script tag right before </head>. Without a working /sw.js, the snippet stays quiet rather than showing a prompt that can’t work.

Plays once it’s running

Back-in-stock and flash-sale pushes are the classic winners. See ecommerce push notifications.

How the Cloudflare Worker route works

  1. Your store’s custom domain must be proxied by Cloudflare (orange cloud).
  2. Create a Worker that fetches https://pusharoo.com/sw.js and returns it with Content-Type: application/javascript and Cache-Control: no-store.
  3. Add a route for yourstore.com/sw.js pointing at that Worker.
  4. Open https://yourstore.com/sw.js in a browser to confirm it serves JavaScript.
  5. Paste the snippet in theme.liquid, then subscribe and send yourself a test.

The browser now sees the worker as part of your store’s origin, so the whole store is covered.

Before you go live

  • Only one service worker on the store (remove any other push app first).
  • Rocket Loader and script optimizers off for /sw.js.
  • Test on Android Chrome and, if you use a manifest, on iPhone from the Home Screen.

Questions

Does Pusharoo have a Shopify app?

Not today. Shopify’s root-file restriction means a Cloudflare Worker route or collecting on your own domain are the practical options.

Why do some Shopify push apps work?

Apps can use Shopify-specific mechanisms or host the subscription page on their own domain. Check which domain your subscribers are actually subscribing to.

More in Platforms: WooCommerce push notifications: setup and playbook · Magento 2 push notifications · Web push on Wix, Squarespace and Webflow · All guides

Free for life. No limits.

Unlimited subscribers, campaigns and automations. No badges. About five minutes to install.