Shopify Development

Shopify Theme Updates: Protecting Your Custom Page Templates from Vanishing

Hey everyone! As a Shopify migration expert at Shopping Cart Mover, I spend a lot of time diving into the community forums, and a recent discussion caught my eye. It’s about a pretty frustrating issue many store owners and developers face: custom page templates mysteriously vanishing or reverting to default after a theme update. This isn't just annoying; it can totally disrupt your carefully crafted pages, impact your SEO, and feel like a major setback.

Let's talk about a specific case that came up in the forums, titled "Horizon updates cause newer pages to change template?". Our community member, anon26642340, was using the Horizon theme and noticed a troubling pattern: after theme updates, any newer pages they'd created (since the last update) would revert to the default page template. Older pages were fine, but their new "podcast" page, for example, kept getting booted off its custom template, even though the Admin settings still showed it assigned correctly!

It’s a head-scratcher, right? You build a beautiful custom page, assign a unique template, and then a routine update seems to undo all your hard work. Anon26642340 even mentioned losing two other pages in a previous update, thinking it was a fluke. But two times? Definitely not a fluke.

Shopify theme code editor showing page.podcast.json file
Shopify theme code editor showing page.podcast.json file

Understanding Why Your Custom Templates Vanish After Theme Updates

Thankfully, a super helpful community member, Vlad_Gerasimchuk, jumped in with a brilliant explanation that really demystifies what’s happening. This isn't you doing anything wrong, folks, and it's not random at all. It's about how theme updates interact with your custom page templates.

When you create a new page template using the theme editor (like anon26642340's "podcast" one), Shopify saves it as a JSON file within your theme's directory. Think of it like templates/page.podcast.json. Now, here's the kicker: when a theme like Horizon gets an update, it essentially replaces the theme's core files with the new version. Any template JSON that came with the previous version of the theme generally survives the merge. However, a custom template you added *since* your last update isn't part of what the updater is designed to merge from the original theme package. Consequently, it can get dropped, overwritten, or reset.

Once that custom JSON file is gone or corrupted, the page that was assigned to it has nothing to point at. Shopify's default behavior in such cases is to fall back to the generic page.json template. This perfectly explains the pattern anon26642340 observed: older pages, whose templates were part of the original theme or successfully merged, remained intact, while only pages created with *new* custom templates since the last update experienced the issue.

The Critical Role of JSON Files in Shopify Themes

Modern Shopify themes, especially those built with OS 2.0 architecture, rely heavily on JSON files to define sections, templates, and settings. These files are the blueprint for your dynamic content. When you customize a page in the theme editor and save it as a new template, you're essentially creating a new JSON file. If this file isn't treated as a core part of the theme by the update process, it's vulnerable. The Admin assignment showing the correct template is a symptom of the missing file, not the cause; the system tries to point to a file that no longer exists or is corrupted, thus defaulting to a fallback display.

Proactive Measures: How to Prevent Template Disasters

As migration experts, we always advocate for robust backup strategies. Here are the essential steps to protect your custom page templates before any theme update:

  • Always Duplicate Your Live Theme First: This is your primary safeguard. Before initiating any theme update, navigate to your Shopify Admin (Online Store > Themes), click the "..." menu next to your live theme, and select "Duplicate." This creates a complete snapshot of your current theme, including all custom JSON files, allowing for an easy rollback if anything goes wrong. This duplicate acts as your safety net, preserving your template files since the code editor's version history might not fully restore JSON files.
  • Backup Custom Template JSON Content Manually: For critical custom templates, go a step further. Access the theme code editor (Online Store > Themes > Actions > Edit code). Under the templates/ directory, locate your custom page JSON files (e.g., page.podcast.json). Copy the raw contents of these files into a separate text document or a cloud storage solution. This gives you an external backup of your section setup, independent of the theme.

The "Actual Fix": Restoring Vanished Templates After an Update

If you've already updated your theme and found your custom templates missing, don't panic. Here’s a detailed, step-by-step guide to restore them, building on Vlad_Gerasimchuk's advice:

  1. Duplicate Your Current Theme (Again): Even if you're fixing an issue, always work on a duplicate. This ensures your live store remains unaffected while you troubleshoot.
  2. Copy Raw JSON Content: If you didn't do this pre-update, check your previous theme versions (if available in your duplicates) or any local backups for the raw contents of your custom page template JSON files (e.g., page.podcast.json and any others). If you have the pre-update duplicate, you can copy the JSON from there.
  3. Update the Duplicate Theme: Proceed with updating the *duplicate* theme to the latest version (e.g., Horizon 4.1.3 in anon26642340's case).
  4. Recreate Custom Templates in the Code Editor: After the update, if your custom templates are gone from the templates/ directory:
    • Go to the theme code editor.
    • Under templates/, click "Add a new template."
    • Choose "Page" and give it the exact same name as your original custom template (e.g., "podcast").
    • Once created, paste your saved JSON content (from Step 2) into this new file, replacing any default content.
    • Save the file.
  5. Reassign Pages to Their Templates in Admin: Finally, navigate to your Shopify Admin > Pages. For each page that reverted, edit the page and, in the "Theme template" section, re-select its newly recreated custom template. Save the page.

This process, while a bit tedious, ensures your custom templates are properly re-established and are less likely to be affected by future updates because you're essentially re-introducing them as custom files, which the updater tends to leave alone more readily than files it recognizes as part of its core package.

Beyond the Fix: Long-Term Development Best Practices

For merchants and developers serious about their Shopify presence, especially those with complex customizations, consider these advanced strategies:

  • Version Control Systems (VCS): Implement Git for your theme development. This allows you to track every change, revert to previous versions seamlessly, and manage merges more effectively, significantly reducing the risk of lost work during updates.
  • Modular Development with Sections and Blocks: Instead of creating entirely new page templates for minor variations, leverage Shopify's Section and Block architecture. Build reusable sections that can be added to any page template. This makes your customizations more modular and often more resilient to theme updates.
  • Thorough Testing: Always test theme updates and new customizations on a duplicate theme first, never directly on your live store. This is especially crucial for stores with high traffic or complex integrations.
  • Report Potential Bugs: As Vlad suggested, if you can consistently reproduce the issue across multiple updates with clear before/after screenshots, consider reporting it to Shopify support. Your feedback helps improve the platform for everyone.

Managing a dynamic e-commerce store means staying on top of updates and ensuring your custom elements remain robust. By understanding the underlying mechanics of theme updates and adopting these proactive and reactive strategies, you can safeguard your Shopify store's unique design and functionality. For those looking to start their own robust Shopify store and avoid such pitfalls from the get-go, you can sign up for Shopify here and begin building your dream e-commerce presence with confidence.

At Shopping Cart Mover, we specialize in seamless migrations and helping merchants optimize their Shopify stores. If you're facing complex theme issues or planning a migration, don't hesitate to reach out to our experts for assistance!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases