Re: Alternate theme layout for Online Store App Proxy

Alternate theme layout for Online Store App Proxy

andrewchak
Visitor
2 0 0

Hey guys,

I have a question around theming using App Proxy when creating a Private App.

 

According to the documentation:
https://shopify.dev/tutorials/display-data-on-an-online-store-with-an-application-proxy-app-extensio...

 

if we return a HTTP response from the proxy URL with the header Content-Type: application/liquid , Shopify will render any Liquid code in the request body in the context of the shop using the shop's theme.

 

While that's all good, by default it uses the default theme file (theme.liquid) when rendering.

 

My question is, is there any way to use an alternate theme file? (eg. theme.alternate.liquid). For example, are there any HTTP response headers that we can set to specify which file to use? (eg. X-Shopify-Theme)

Replies 3 (3)

SBD_
Shopify Staff
1831 273 418

Hey @andrewchak 

I haven't seen this done before, but it might be possible - try including {% layout something %} in the response.

https://shopify.dev/docs/themes/liquid/reference/tags/theme-tags#layout

Scott | Developer Advocate @ Shopify 

andrewchak
Visitor
2 0 0

Thanks Scotty, will give it a try and see if it works.

HunkyBill
Shopify Partner
4853 60 562

I always thought the Liquid was rendered in the context of content_for_layout at which point it is too late to change theme. It is the sandwhich filling in the content, not the bread. Be interesting to see how that plays out.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com