discount Automatic Free Shipping Updatemutation
mutation
2024-10latest
Requires Apps must have write
access scope.
Updates a free shipping automatic discount.
Arguments
The input data used to update the automatic discount.
The ID of the automatic discount to update.
Was this section helpful?
DiscountAutomaticFreeShippingUpdatePayload returns
The updated automatic discount.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: discountAutomaticFreeShippingUpdate
Query Reference for MUTATION: discountAutomaticFreeShippingUpdate
"mutation discountAutomaticFreeShippingUpdate($freeShippingAutomaticDiscount: DiscountAutomaticFreeShippingInput!, $id: ID!) {\n discountAutomaticFreeShippingUpdate(freeShippingAutomaticDiscount: $freeShippingAutomaticDiscount, id: $id) {\n automaticDiscountNode {\n # DiscountAutomaticNode fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: discountAutomaticFreeShippingUpdate
"{\n \"freeShippingAutomaticDiscount\": {\n \"appliesOnOneTimePurchase\": true,\n \"appliesOnSubscription\": true,\n \"combinesWith\": {\n \"orderDiscounts\": true,\n \"productDiscounts\": true,\n \"shippingDiscounts\": true\n },\n \"destination\": {\n \"all\": true,\n \"countries\": {\n \"add\": [\n \"AC\"\n ],\n \"includeRestOfWorld\": true,\n \"remove\": [\n \"AC\"\n ]\n }\n },\n \"endsAt\": \"2019-09-07T15:50:00Z\",\n \"maximumShippingPrice\": \"29.99\",\n \"minimumRequirement\": {\n \"quantity\": {\n \"greaterThanOrEqualToQuantity\": \"50\"\n },\n \"subtotal\": {\n \"greaterThanOrEqualToSubtotal\": \"29.99\"\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: discountAutomaticFreeShippingUpdate
"input DiscountAutomaticFreeShippingInput {\n appliesOnOneTimePurchase: Boolean\n appliesOnSubscription: Boolean\n combinesWith: DiscountCombinesWithInput\n destination: DiscountShippingDestinationSelectionInput\n endsAt: DateTime\n maximumShippingPrice: Decimal\n minimumRequirement: DiscountMinimumRequirementInput\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 DiscountShippingDestinationSelectionInput {\n all: Boolean\n countries: DiscountCountriesInput\n}\n\ninput DiscountMinimumRequirementInput {\n quantity: DiscountMinimumQuantityInput\n subtotal: DiscountMinimumSubtotalInput\n}\n"
Display Examples for MUTATION: discountAutomaticFreeShippingUpdate
[ { "example": { "type_name": "discountautomaticfreeshippingupdate", "title": "Update an automatic free shipping discount", "description": "Creating an automatic discount", "query_string": "mutation M($id: ID!, $freeShippingAutomaticDiscount: DiscountAutomaticFreeShippingInput!) {\n discountAutomaticFreeShippingUpdate(id: $id, freeShippingAutomaticDiscount: $freeShippingAutomaticDiscount) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticFreeShipping {\n title\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n}", "variables": { "id": "gid://shopify/DiscountAutomaticNode/1057371205", "freeShippingAutomaticDiscount": { "title": "A new title" } }, "response": { "data": { "discountAutomaticFreeShippingUpdate": { "automaticDiscountNode": { "automaticDiscount": { "title": "A new title" } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/pricing/test/unit/graph_api/admin/mutations/discount_automatic_free_shipping_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 M($id: ID!, $freeShippingAutomaticDiscount: DiscountAutomaticFreeShippingInput!) { discountAutomaticFreeShippingUpdate(id: $id, freeShippingAutomaticDiscount: $freeShippingAutomaticDiscount) { automaticDiscountNode { automaticDiscount { ... on DiscountAutomaticFreeShipping { title } } } userErrors { message field code } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/1057371205\",\n \"freeShippingAutomaticDiscount\": {\n \"title\": \"A new title\"\n }\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation M($id: ID!, $freeShippingAutomaticDiscount: DiscountAutomaticFreeShippingInput!) {\n discountAutomaticFreeShippingUpdate(id: $id, freeShippingAutomaticDiscount: $freeShippingAutomaticDiscount) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticFreeShipping {\n title\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DiscountAutomaticNode/1057371205\",\n \"freeShippingAutomaticDiscount\": {\n \"title\": \"A new title\"\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 M($id: ID!, $freeShippingAutomaticDiscount: DiscountAutomaticFreeShippingInput!) {\n discountAutomaticFreeShippingUpdate(id: $id, freeShippingAutomaticDiscount: $freeShippingAutomaticDiscount) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticFreeShipping {\n title\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DiscountAutomaticNode/1057371205\",\n \"freeShippingAutomaticDiscount\": {\n \"title\": \"A new title\"\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 M($id: ID!, $freeShippingAutomaticDiscount: DiscountAutomaticFreeShippingInput!) {\n discountAutomaticFreeShippingUpdate(id: $id, freeShippingAutomaticDiscount: $freeShippingAutomaticDiscount) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticFreeShipping {\n title\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DiscountAutomaticNode/1057371205\",\n \"freeShippingAutomaticDiscount\": {\n \"title\": \"A new title\"\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 M($id: ID!, $freeShippingAutomaticDiscount: DiscountAutomaticFreeShippingInput!) {\n discountAutomaticFreeShippingUpdate(id: $id, freeShippingAutomaticDiscount: $freeShippingAutomaticDiscount) {\n automaticDiscountNode {\n automaticDiscount {\n ... on DiscountAutomaticFreeShipping {\n title\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/DiscountAutomaticNode/1057371205\",\n \"freeShippingAutomaticDiscount\" => [\n \"title\" => \"A new title\",\n ],\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 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/1057371205\"", "typeKind": "MUTATION" }, { "arg": { "name": "freeShippingAutomaticDiscount", "description": "The input data used to update the automatic discount.", "type": { "kind": "INPUT_OBJECT", "name": "DiscountAutomaticFreeShippingInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "DiscountAutomaticFreeShippingInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "freeShippingAutomaticDiscount", "argValue": " {\"title\":\"A new title\"}", "typeKind": "MUTATION" } ] } ]