Hi, i’m developing an application that adds sections to a theme, and I want to include a “Try Section” feature, like in the picture. How should I implement this? Are there any document available?
Thank you!
Hi, i’m developing an application that adds sections to a theme, and I want to include a “Try Section” feature, like in the picture. How should I implement this? Are there any document available?
Thank you!
Hi Peter - I think this might be more suitable for the Extensions board (and theme app extensions tag). Are you working with a theme app extension? Also where is this screenshot from?
One thought is you could include it in the theme using the Assets API (but you may need special permissions for that, and if you do it should probably be a unique file name so that it does not overwrite anything that may currently be there).
If you are using theme app extensions as @Liam-Shopify was saying, you could deep-link to them in the Theme Editor but I do not think “try” would work there…
You may link to it on a separate demo store where it is already implemented if that is allowed.
From Shopify Functions to Extensions
Added theme-app-extension and removed general-functions
Hi @Liam-Shopify @RobDukarski
It’s an app from the store that I installed. When I click the “Try section” button, it creates a trial theme to test the newly added section. I don’t know the exact way to do this.
Check my image:
So a whole custom theme is added to test an apps section? I don’t think I’ve seen behaviour like that from theme app extensions before.
Yes, it does. It creates a trial theme with just one section. I’ve seen quite a few apps like that on the Shopify store, but I’m not sure how they implemented it.
Let me look into how to achieve this effect.
I believe you could use it.
The only way to achieve this is by using the Asset API. Deep linking can work for a limited number of sections, but the Shopify app’s liquid size limit (max 100KB) restricts how many sections you can create. Each section consumes part of this 100KB limit, which quickly leads to hitting the cap on the number of sections.
The app shown in the screenshot is creating a trial theme and leveraging the Asset API to inject these sections. They have an Asset API exemption, allowing them to add new files to the theme.
I guess setting the theme role as “DEMO” was an option in Rest API (Legacy), and an equivalent for it doesn’t exist in GraphQL API
Considering All-in on GraphQL: the future of app development at Shopify (2024) - Shopify you, can’t do anything about it, unless shopify releases support for role
in GraphQL theme create mutation query. The other app you are looking at will likely have to shut this feature off too, while moving away from Rest
Yes, I got it working with the REST API, but I’d rather not use it since it’ll be a legacy API as of October 1, 2024. The GraphQL themeCreate
mutation, however, doesn’t include a role
argument. Do you know if Shopify plans to add support for this in GraphQL in the future?