scriptTagDelete
Requires access scope.
Theme app extensions
Your app might not pass App Store review if it uses script tags instead of theme app extensions. All new apps, and apps that integrate with Online Store 2.0 themes, should use theme app extensions, such as app blocks or app embed blocks. Script tags are an alternative you can use with only vintage themes. Learn more.
Script tag deprecation
Script tags will be sunset for the Order status page on August 28, 2025. Upgrade to Checkout Extensibility before this date. Shopify Scripts will continue to work alongside Checkout Extensibility until August 28, 2025.
Deletes a script tag.
Arguments
- •ID!required
The ID of the script tag to delete.
Anchor to ScriptTagDeletePayload returnsScriptTagDeletePayload returns
- Anchor to deletedScriptTagIddeleted•
Script Tag Id The ID of the deleted script tag.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
- Deletes a script tag
- scriptTagDelete reference
Examples
mutation ScriptTagDelete($id: ID!) {
scriptTagDelete(id: $id) {
deletedScriptTagId
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 ScriptTagDelete($id: ID!) { scriptTagDelete(id: $id) { deletedScriptTagId userErrors { field message } } }",
"variables": {
"id": "gid://shopify/ScriptTag/421379493"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation ScriptTagDelete($id: ID!) {
scriptTagDelete(id: $id) {
deletedScriptTagId
userErrors {
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/ScriptTag/421379493"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation ScriptTagDelete($id: ID!) {
scriptTagDelete(id: $id) {
deletedScriptTagId
userErrors {
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/ScriptTag/421379493"
},
},
});
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 ScriptTagDelete($id: ID!) {
scriptTagDelete(id: $id) {
deletedScriptTagId
userErrors {
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/ScriptTag/421379493"
}
response = client.query(query: query, variables: variables)