discount Automatic Deactivatemutation
mutation
2024-10latest
Requires Apps must have write
access scope.
Deactivates an automatic discount.
Arguments
The ID of the automatic discount to deactivate.
Was this section helpful?
DiscountAutomaticDeactivatePayload returns
The deactivated automatic discount.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: discountAutomaticDeactivate
Query Reference for MUTATION: discountAutomaticDeactivate
"mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n # DiscountAutomaticNode fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: discountAutomaticDeactivate
"{\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: discountAutomaticDeactivate
""
Display Examples for MUTATION: discountAutomaticDeactivate
[ { "example": { "type_name": "discountautomaticdeactivate", "title": "Deactivate an active automatic discount", "description": "Deactivating an active automatic discount sets the `endsAt` to now. In this example, the `endsAt` was originally set to January 1, 2049.", "query_string": "mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "id": "gid://shopify/DiscountAutomaticNode/198286294" }, "response": { "data": { "discountAutomaticDeactivate": { "automaticDiscountNode": { "automaticDiscount": { "status": "EXPIRED", "startsAt": "2024-09-12T01:08:08Z", "endsAt": "2024-09-12T01:08:08Z" } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/pricing/test/unit/graph_api/admin/mutations/discount_automatic_deactivate_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation discountAutomaticDeactivate($id: ID!) { discountAutomaticDeactivate(id: $id) { automaticDiscountNode { automaticDiscount { ... on DiscountAutomaticBxgy { status startsAt endsAt } } } userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DiscountAutomaticNode/198286294\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the automatic discount to deactivate.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/DiscountAutomaticNode/198286294\"", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "discountautomaticdeactivate", "title": "Deactivate an automatic discount set to start in the future", "description": "Deactivating an automatic discount set in the future sets its `startsAt` and `endsAt` to now. In this example, the `startsAt` and `endsAt` were originally set in the year 2049.", "query_string": "mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "id": "gid://shopify/DiscountAutomaticNode/198286294" }, "response": { "data": { "discountAutomaticDeactivate": { "automaticDiscountNode": { "automaticDiscount": { "status": "EXPIRED", "startsAt": "2024-09-12T01:08:08Z", "endsAt": "2024-09-12T01:08:08Z" } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/pricing/test/unit/graph_api/admin/mutations/discount_automatic_deactivate_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation discountAutomaticDeactivate($id: ID!) { discountAutomaticDeactivate(id: $id) { automaticDiscountNode { automaticDiscount { ... on DiscountAutomaticBxgy { status startsAt endsAt } } } userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/198286294\"\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation discountAutomaticDeactivate($id: ID!) {\n discountAutomaticDeactivate(id: $id) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticBxgy {\n status\n startsAt\n endsAt\n }\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DiscountAutomaticNode/198286294\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the automatic discount to deactivate.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "id", "argValue": " \"gid://shopify/DiscountAutomaticNode/198286294\"", "typeKind": "MUTATION" } ] } ]