Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Liquid to JSON conversion gives "Failed to create contextual templates. Please try again&qu

Liquid to JSON conversion gives "Failed to create contextual templates. Please try again" error

simonbarker
Shopify Partner
9 0 9

I am converting the customer/order.liquid template page to a JSON page so we can make use of sections etc (we put a lot more in our customer order page than is typical so this would be a nice business benefit and reduce dev workload).

 

When I convert the page over, the content displays in the theme editor but I get the following red error at the bottom of the screen and the page inside the editor constantly reloads.

 

"Failed to create contextual templates. Please try again"

 

CleanShot 2023-08-03 at 14.55.38@2x.png

 

Viewing the page published on the store is totally fine, no constant reloads. 

 

I have checked that there are no {% section %} tags in the new .liquid section and I have stripped even stripped down the new customer-order.liquid page contents to just an <h2> tag.

 

The new customer/order.json template file contents is:

 

{
  "sections": {
    "main": {
      "type": "customer-order",
      "settings": {
      }
    }
  },
  "order": [
    "main"
  ]
}

 

and the contents of the `customer-order.liquid` section file is 

 

<h2>Order details page</h2>

 

Any suggestions would be great.

Replies 10 (10)

DTCDevelopers
Shopify Partner
2 0 4

I'm having the same issue on my /customers/order.liquid template. Not sure what's going on. Driving me nuts! First experienced Aug 1st, 2023.

simonbarker
Shopify Partner
9 0 9

Interesting, I have an old branch where I tried this once before in mid July and this issue didn't happen. I had other issues with that attempt so left the branch and waited a couple of weeks to have another go.

 

Are you seeing it on any page you convert to .json, any customers/ page or just the customer/order page?

DTCDevelopers
Shopify Partner
2 0 4

@simonbarker I'm only seeing it order.liquid. We haven't actually converted it to .json yet. 

simone_bogni
Shopify Partner
9 0 8

We are also having the same issue, and as far as I can see, it's only on the order template.
I'm hoping in an official response from the Shopify staff.

simonbarker
Shopify Partner
9 0 9

Sadly we can't just @Shopify and summon them, fingers crossed they see this

simone_bogni
Shopify Partner
9 0 8

I've opened a ticket but to be honest I haven't really received an answer so far.
I got one, but it wasn't related.


To give more context (I'll edit my comment above too), we are using custom order templates. Something like order.my_special_order.liquid.
We switch to these templates using the "view" parameter in the query string (link .../orders/id?view=my_special_order).
That still works wonderfully on the customer side. If anyone logs into their account and they go to the order page, everything works fine.
The issue is inside the theme editor, where the page keeps refreshing in a loop.
That means that the sections in those templates can't be customized further.
This part of the themes haven't been changed in months.
Also it looks like Shopify is pushing additional parameters in the query string (like the market one).
It also happened months ago that that parameter caused problems in the theme editor - and I think to remember that Shopify rolled back the changes back then.
Basically the sections in the same templates became locked and it wasn't possible to edit them.

So far the reply has been to add a new fresh theme from the market and try to see if the error persists there - which I believe has no relevance at all, since we are talking about custom themes (still based on Dawn).
Whatever new theme we add will not have the custom templates.

simonbarker
Shopify Partner
9 0 9

That's a frustrating reply for sure.

 

We are using a heavily customised version of Minimog so I highly doubt changing to a new theme from the market will make any difference. That feels like "turn it off and on again".

 

We are about to migrate Minimog from v2.5 to v3.5 so we'll see if that helps (seems unlikely)

 

I had no idea you could switch templates with query params like that, interesting.

 

I didn't know about passing a query param to change a template

simone_bogni
Shopify Partner
9 0 8

Yeah, it's a nice feature that turned out to be very helpful for us.
Here's some doc from the Shopify blog (scroll down to the section called "Switch templates via the URL"): https://www.shopify.com/partners/blog/shopify-alternate-templates

ninegabbs
Visitor
1 0 1

I'm also getting the same issue since recently. I'm using the Dawn v7 theme.
Because of this issue I'm also unable to customise the order page using the OS2 menus, the sidebar shows the below message as it keeps reloading: 
```

Customer account templates can only be customized in the Default context.

```
Must be something related to localization and Markets?

bekah_mcdonald
Shopify Partner
3 0 2

Deeply frustrating! I'm building a custom theme based on Dawn 11.0.0 and experiencing the same problem. In the Customizer, I can't view the customer order page - it keeps on changing the market context to GB, appending `&market=gb` in the URL.