Requires write_products
access scope. Also: The user must have a permission to edit products and delete product variants.
Deletes one or more options from a product. Product options define the choices available for a product, such as size, color, or material.
Removing an option can affect a product's variants and their configuration. Deleting an option might also delete associated option values and, depending on the chosen strategy, might affect variants.
Use the productOptionsDelete
mutation for the following use cases:
The productOptionsDelete
mutation enforces strict data integrity for product options and variants. All option positions must remain sequential, and every remaining option must be used by at least one variant.
After you delete a product option, you can further manage a product's configuration using related mutations:
productOptionsCreate
productOptionUpdate
productOptionsReorder
productVariantsBulkCreate
productVariantsBulkUpdate
productSet
Learn more about the product model and adding product data.
IDs of the options to delete from the product.
ID of the product from which to delete the options.
The strategy defines which behavior the mutation should observe,such as how to handle a situation where deleting an option would result in duplicate variants.
IDs of the options deleted.
The updated product object.
The list of errors that occurred from executing the mutation.
mutation deleteOptions($productId: ID!, $options: [ID!]!, $strategy: ProductOptionDeleteStrategy) { productOptionsDelete(productId: $productId, options: $options, strategy: $strategy) { userErrors { field message code } deletedOptionsIds product { id options { id name values position optionValues { id name hasVariants } } } } }
curl -X POST \ https://your-development-store.myshopify.com/admin/api/2025-07/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "mutation deleteOptions($productId: ID!, $options: [ID!]!, $strategy: ProductOptionDeleteStrategy) { productOptionsDelete(productId: $productId, options: $options, strategy: $strategy) { userErrors { field message code } deletedOptionsIds product { id options { id name values position optionValues { id name hasVariants } } } } }", "variables": { "productId": "gid://shopify/Product/20995642", "options": [ "gid://shopify/ProductOption/328272168" ] } }'
const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql mutation deleteOptions($productId: ID!, $options: [ID!]!, $strategy: ProductOptionDeleteStrategy) { productOptionsDelete(productId: $productId, options: $options, strategy: $strategy) { userErrors { field message code } deletedOptionsIds product { id options { id name values position optionValues { id name hasVariants } } } } }`, { variables: { "productId": "gid://shopify/Product/20995642", "options": [ "gid://shopify/ProductOption/328272168" ] }, }, ); const data = await response.json();
const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `mutation deleteOptions($productId: ID!, $options: [ID!]!, $strategy: ProductOptionDeleteStrategy) { productOptionsDelete(productId: $productId, options: $options, strategy: $strategy) { userErrors { field message code } deletedOptionsIds product { id options { id name values position optionValues { id name hasVariants } } } } }`, "variables": { "productId": "gid://shopify/Product/20995642", "options": [ "gid://shopify/ProductOption/328272168" ] }, }, });
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 deleteOptions($productId: ID!, $options: [ID!]!, $strategy: ProductOptionDeleteStrategy) { productOptionsDelete(productId: $productId, options: $options, strategy: $strategy) { userErrors { field message code } deletedOptionsIds product { id options { id name values position optionValues { id name hasVariants } } } } } QUERY variables = { "productId": "gid://shopify/Product/20995642", "options": [ "gid://shopify/ProductOption/328272168" ] } response = client.query(query: query, variables: variables)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4