It seems that it is not possible to read/write themes that have role “DEMO” to avoid copying paid themes files for free.
Why do you need to be able to read/write theme files that you don’t own anyway?
Currently you can only check if an theme app extension is active, by reading config/settings_data.json
Having access to this file is also important during automated tests, because we can sync an theme app extension configuration across multiple themes in seconds.
Won’t this enable people to steal themes?
No because config/settings_data.json
is a file required to be present in all themes and to have the same structure.
How to replicate what you’re describing?
- Go to the theme store: Ecommerce Website Templates - Free and Premium Themes for Your Online Store.
- Try a theme you do not own
- Run this query:
query DemoTheme {
themes(first: 1, roles: [DEMO]) {
nodes {
id
name
files(filenames: ["config/settings_data.json"], first: 1) {
nodes {
body {
... on OnlineStoreThemeFileBodyText {
__typename
}
}
}
}
}
}
}
- You should see this response:
{
"errors": [
{
"message": "Access denied",
"locations": [
{
"line": 6,
"column": 7
}
],
"path": [
"themes",
"nodes",
0,
"files"
],
"extensions": {
"code": "ACCESS_DENIED",
"documentation": "https://shopify.dev/api/usage/access-scopes"
}
}
],
"data": {
"themes": {
"nodes": [
{
"id": "gid://shopify/OnlineStoreTheme/143571910818",
"name": "Lollipop",
"files": null
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 6,
"actualQueryCost": 5,
"throttleStatus": {
"maximumAvailable": 2000,
"currentlyAvailable": 1995,
"restoreRate": 100
}
}
}
}