CSS/JS assets render stale via ?preview_theme_id= storefront URL after CLI push or GitHub integration sync, despite files being confirmed correct in the theme editor
Reproduction steps
Update CSS and/or JS in a theme’s assets and deploy to a store. We see this both via Shopify CLI (shopify theme push --theme --allow-live --force, CLI 3.70.0) and via the native GitHub/Shopify integration sync, so it is not specific to one deploy method.
Confirm the files synced correctly: open the theme code editor in admin and verify the updated CSS/JS is present and correct. (We have confirmed this every time.)
Observe that the correct theme loads (matching the ID), but the CSS and/or JS served is stale, showing the previous version’s styles/behaviour rather than the updated assets.
The asset content is correct at source. We have verified the updated files in the theme code editor every time this occurs, and the shopifypreview.com share link confirms the correct assets exist and render. The issue is isolated to the ?preview_theme_id= storefront render path serving stale CSS/JS.
This happens intermittently (“sometimes”), not on every deploy, and affects CSS and/or JS independently.
It is not specific to our deploy tooling. We see it both through an automated CLI deploy (GitHub Actions running shopify theme push) and on other clients that rely solely on the native GitHub/Shopify integration to sync. The common factor is the ?preview_theme_id= preview path, not how the files arrive on the store.
Things we have tried that do NOT resolve it:
“Reset to latest commit” on the GitHub integration (expected, since the files already match source)
Hard refresh / cache bypass in the browser
The ONLY reliable fix we have found is deleting the theme and re-adding it. This
Update CSS and/or JS in a theme’s assets and deploy to a store. We see this both via Shopify CLI (shopify theme push --theme --allow-live --force, CLI 3.70.0) and via the native GitHub/Shopify integration sync, so it is not specific to one deploy method.
Confirm the files synced correctly: open the theme code editor in admin and verify the updated CSS/JS is present and correct. (We have confirmed this every time.)
Observe that the correct theme loads (matching the ID), but the CSS and/or JS served is stale, showing the previous version’s styles/behaviour rather than the updated assets.
Observe that the shopifypreview.com link renders the correct, updated CSS/JS.
Additional Information:
The asset content is correct at source. We have verified the updated files in the theme code editor every time this occurs, and the shopifypreview.com share link confirms the correct assets exist and render. The issue is isolated to the ?preview_theme_id= storefront render path serving stale CSS/JS.
This happens intermittently (“sometimes”), not on every deploy, and affects CSS and/or JS independently.
It is not specific to our deploy tooling. We see it both through an automated CLI deploy (GitHub Actions running shopify theme push) and on other clients that rely solely on the native GitHub/Shopify integration to sync. The common factor is the ?preview_theme_id= preview path, not how the files arrive on the store.
Things we have tried that do NOT resolve it:
“Reset to latest commit” on the GitHub integration (expected, since the files already match source)
Hard refresh / cache bypass in the browser
The ONLY reliable fix we have found is deleting the theme and re-adding it. This is highly disruptive for us because our deployment workflow hardcodes theme IDs to target the correct theme on each store (we keep one theme as the live target and push to it). Deleting and re-adding changes the theme ID and breaks that workflow, requiring manual reconfiguration.
Diagnostic we can provide: next time this occurs we can capture the DevTools Network tab for the stale ?preview_theme_id= page and compare the asset request URLs (including the ?v= version parameter) against the working shopifypreview.com render, to help identify whether this is stale edge caching on the preview path. Happy to provide this plus HAR files, store/theme IDs, and timestamps on request.
Are you manually navigating to the ?preview_theme_id URLs? Are you going to them from the Admin? Do you see the preview bar on the bottom when this issue happens?