Anchor to themeUpdatetheme
themeUpdate
mutation
Requires The user needs write_themes and an exemption from Shopify to modify themes. If you think that your app is eligible for an exemption and should have access to this API, then you can submit an exception request.
Updates a theme.
Anchor to Arguments
Arguments
- •ID!required
The ID of the theme to be updated.
- Anchor to inputinput•Online
Store requiredTheme Input! The attributes of the theme to be updated.
Was this section helpful?
Anchor to ThemeUpdatePayload returnsThemeUpdatePayload returns
- Anchor to themetheme•
The theme that was updated.
- Anchor to userErrorsuser•
Errors [ThemeUpdate non-nullUser Error!]! The list of errors that occurred from executing the mutation.
Was this section helpful?
- Update the name of a theme
- themeUpdate reference
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation themeUpdate($id: ID!, $input: OnlineStoreThemeInput!) {
themeUpdate(id: $id, input: $input) {
theme {
id
name
}
userErrors {
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/OnlineStoreTheme/908009861",
"input": {
"name": "Dawn - Summer Sale"
}
},
},
);
const data = await response.json();
mutation themeUpdate($id: ID!, $input: OnlineStoreThemeInput!) {
themeUpdate(id: $id, input: $input) {
theme {
id
name
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation themeUpdate($id: ID!, $input: OnlineStoreThemeInput!) { themeUpdate(id: $id, input: $input) { theme { id name } userErrors { field message } } }",
"variables": {
"id": "gid://shopify/OnlineStoreTheme/908009861",
"input": {
"name": "Dawn - Summer Sale"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation themeUpdate($id: ID!, $input: OnlineStoreThemeInput!) {
themeUpdate(id: $id, input: $input) {
theme {
id
name
}
userErrors {
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/OnlineStoreTheme/908009861",
"input": {
"name": "Dawn - Summer Sale"
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation themeUpdate($id: ID!, $input: OnlineStoreThemeInput!) {
themeUpdate(id: $id, input: $input) {
theme {
id
name
}
userErrors {
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/OnlineStoreTheme/908009861",
"input": {
"name": "Dawn - Summer Sale"
}
},
},
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation themeUpdate($id: ID!, $input: OnlineStoreThemeInput!) {
themeUpdate(id: $id, input: $input) {
theme {
id
name
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/OnlineStoreTheme/908009861",
"input": {
"name": "Dawn - Summer Sale"
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"id": "gid://shopify/OnlineStoreTheme/908009861",
"input": {
"name": "Dawn - Summer Sale"
}
}
Response
JSON{
"themeUpdate": {
"theme": {
"id": "gid://shopify/OnlineStoreTheme/908009861",
"name": "Dawn - Summer Sale"
},
"userErrors": []
}
}