Created
June 5, 2025 17:20
-
-
Save ctrlaltdylan/be3b074fd075f653b72cd16ef59a3f6a to your computer and use it in GitHub Desktop.
[Shopify] Retrieve the template JSON of the published theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch("shopify:admin/api/2025-04/graphql.json", { | |
method: "POST", | |
body: JSON.stringify({ | |
query: ` | |
query { | |
themes(first: 1, roles: MAIN) { | |
edges { | |
node { | |
name | |
id | |
role | |
files(filenames: ["templates/product.json"]) { | |
nodes { | |
filename | |
body { | |
... on OnlineStoreThemeFileBodyText { | |
content | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
`, | |
}), | |
}) | |
.then((res) => res.json()) | |
.then((data) => { | |
console.log(data); | |
}) | |
.catch((err) => { | |
console.error(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment