discount Automatic App Updatemutation
mutation
2024-10latest
Requires write
access scope.
Updates an automatic app discount.
Arguments
The input fields required to update the automatic app discount.
The ID of the automatic app discount to update.
Was this section helpful?
DiscountAutomaticAppUpdatePayload returns
The updated automatic app discount.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: discountAutomaticAppUpdate
Query Reference for MUTATION: discountAutomaticAppUpdate
"mutation discountAutomaticAppUpdate($automaticAppDiscount: DiscountAutomaticAppInput!, $id: ID!) {\n discountAutomaticAppUpdate(automaticAppDiscount: $automaticAppDiscount, id: $id) {\n automaticAppDiscount {\n # DiscountAutomaticApp fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: discountAutomaticAppUpdate
"{\n \"automaticAppDiscount\": {\n \"appliesOnSubscription\": true,\n \"combinesWith\": {\n \"orderDiscounts\": true,\n \"productDiscounts\": true,\n \"shippingDiscounts\": true\n },\n \"endsAt\": \"2019-09-07T15:50:00Z\",\n \"functionId\": \"<your-functionId>\",\n \"metafields\": [\n {\n \"description\": \"<your-description>\",\n \"id\": \"gid://shopify/<objectName>/10079785100\",\n \"key\": \"<your-key>\",\n \"namespace\": \"<your-namespace>\",\n \"type\": \"<your-type>\",\n \"value\": \"<your-value>\"\n }\n ],\n \"recurringCycleLimit\": 1,\n \"startsAt\": \"2019-09-07T15:50:00Z\",\n \"title\": \"<your-title>\"\n },\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: discountAutomaticAppUpdate
"input DiscountAutomaticAppInput {\n appliesOnSubscription: Boolean\n combinesWith: DiscountCombinesWithInput\n endsAt: DateTime\n functionId: String\n metafields: [MetafieldInput!]\n recurringCycleLimit: Int\n startsAt: DateTime\n title: String\n}\n\ninput DiscountCombinesWithInput {\n orderDiscounts: Boolean\n productDiscounts: Boolean\n shippingDiscounts: Boolean\n}\n\ninput MetafieldInput {\n description: String\n id: ID\n key: String\n namespace: String\n type: String\n value: String\n}\n"
Display Examples for MUTATION: discountAutomaticAppUpdate
[ { "example": { "type_name": "discountautomaticappupdate", "title": "Update an app automatic discount", "description": "This endpoint updates an app automatic discount.\n", "query_string": "mutation discountAutomaticAppUpdate($automaticAppDiscount: DiscountAutomaticAppInput!, $id: ID!) {\n discountAutomaticAppUpdate(automaticAppDiscount: $automaticAppDiscount, id: $id) {\n automaticAppDiscount {\n discountId\n title\n startsAt\n endsAt\n status\n appDiscountType {\n appKey\n functionId\n }\n combinesWith {\n orderDiscounts\n productDiscounts\n shippingDiscounts\n }\n }\n userErrors {\n field\n message\n }\n }\n}", "variables": { "id": "gid://shopify/DiscountAutomaticNode/159339796", "automaticAppDiscount": { "title": "Take 5$ from order discount", "endsAt": "2024-08-29T01:05:24Z" } }, "response": { "data": { "discountAutomaticAppUpdate": { "automaticAppDiscount": { "discountId": "gid://shopify/DiscountAutomaticNode/159339796", "title": "Take 5$ from order discount", "startsAt": "2024-08-23T01:05:24Z", "endsAt": "2024-08-29T01:05:24Z", "status": "EXPIRED", "appDiscountType": { "appKey": "shopify-vm-test-app", "functionId": "16ffe691-6584-44ea-8396-b54c24dd033d" }, "combinesWith": { "orderDiscounts": false, "productDiscounts": false, "shippingDiscounts": false } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/pricing/test/unit/graph_api/admin/mutations/discount_automatic_app_update_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 discountAutomaticAppUpdate($automaticAppDiscount: DiscountAutomaticAppInput!, $id: ID!) { discountAutomaticAppUpdate(automaticAppDiscount: $automaticAppDiscount, id: $id) { automaticAppDiscount { discountId title startsAt endsAt status appDiscountType { appKey functionId } combinesWith { orderDiscounts productDiscounts shippingDiscounts } } userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/159339796\",\n \"automaticAppDiscount\": {\n \"title\": \"Take 5$ from order discount\",\n \"endsAt\": \"2024-08-29T01:05:24Z\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation discountAutomaticAppUpdate($automaticAppDiscount: DiscountAutomaticAppInput!, $id: ID!) {\n discountAutomaticAppUpdate(automaticAppDiscount: $automaticAppDiscount, id: $id) {\n automaticAppDiscount {\n discountId\n title\n startsAt\n endsAt\n status\n appDiscountType {\n appKey\n functionId\n }\n combinesWith {\n orderDiscounts\n productDiscounts\n shippingDiscounts\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DiscountAutomaticNode/159339796\",\n \"automaticAppDiscount\": {\n \"title\": \"Take 5$ from order discount\",\n \"endsAt\": \"2024-08-29T01:05:24Z\"\n }\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 discountAutomaticAppUpdate($automaticAppDiscount: DiscountAutomaticAppInput!, $id: ID!) {\n discountAutomaticAppUpdate(automaticAppDiscount: $automaticAppDiscount, id: $id) {\n automaticAppDiscount {\n discountId\n title\n startsAt\n endsAt\n status\n appDiscountType {\n appKey\n functionId\n }\n combinesWith {\n orderDiscounts\n productDiscounts\n shippingDiscounts\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DiscountAutomaticNode/159339796\",\n \"automaticAppDiscount\": {\n \"title\": \"Take 5$ from order discount\",\n \"endsAt\": \"2024-08-29T01:05:24Z\"\n }\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 discountAutomaticAppUpdate($automaticAppDiscount: DiscountAutomaticAppInput!, $id: ID!) {\n discountAutomaticAppUpdate(automaticAppDiscount: $automaticAppDiscount, id: $id) {\n automaticAppDiscount {\n discountId\n title\n startsAt\n endsAt\n status\n appDiscountType {\n appKey\n functionId\n }\n combinesWith {\n orderDiscounts\n productDiscounts\n shippingDiscounts\n }\n }\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/159339796\",\n \"automaticAppDiscount\": {\n \"title\": \"Take 5$ from order discount\",\n \"endsAt\": \"2024-08-29T01:05:24Z\"\n }\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 discountAutomaticAppUpdate($automaticAppDiscount: DiscountAutomaticAppInput!, $id: ID!) {\n discountAutomaticAppUpdate(automaticAppDiscount: $automaticAppDiscount, id: $id) {\n automaticAppDiscount {\n discountId\n title\n startsAt\n endsAt\n status\n appDiscountType {\n appKey\n functionId\n }\n combinesWith {\n orderDiscounts\n productDiscounts\n shippingDiscounts\n }\n }\n userErrors {\n field\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DiscountAutomaticNode/159339796\",\n \"automaticAppDiscount\" => [\n \"title\" => \"Take 5$ from order discount\",\n \"endsAt\" => \"2024-08-29T01:05:24Z\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the automatic app discount to update.", "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/159339796\"", "typeKind": "MUTATION" }, { "arg": { "name": "automaticAppDiscount", "description": "The input fields required to update the automatic app discount.", "type": { "kind": "INPUT_OBJECT", "name": "DiscountAutomaticAppInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "DiscountAutomaticAppInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "automaticAppDiscount", "argValue": " {\"title\":\"Take 5$ from order discount\",\"endsAt\":\"2024-08-29T01:05:24Z\"}", "typeKind": "MUTATION" } ] } ]