Skip to content

Instantly share code, notes, and snippets.

@ctrlaltdylan
Created June 5, 2025 17:20
Show Gist options
  • Save ctrlaltdylan/be3b074fd075f653b72cd16ef59a3f6a to your computer and use it in GitHub Desktop.
Save ctrlaltdylan/be3b074fd075f653b72cd16ef59a3f6a to your computer and use it in GitHub Desktop.
[Shopify] Retrieve the template JSON of the published theme
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