discount Code Free Shipping Updatemutation
mutation
2024-10latest
Requires Apps must have write
access scope.
Updates a free shipping code discount.
Arguments
The input data used to update the code discount.
The ID of the code discount to update.
Was this section helpful?
DiscountCodeFreeShippingUpdatePayload returns
The updated code discount.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: discountCodeFreeShippingUpdate
Query Reference for MUTATION: discountCodeFreeShippingUpdate
"mutation discountCodeFreeShippingUpdate($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!, $id: ID!) {\n discountCodeFreeShippingUpdate(freeShippingCodeDiscount: $freeShippingCodeDiscount, id: $id) {\n codeDiscountNode {\n # DiscountCodeNode fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: discountCodeFreeShippingUpdate
"{\n \"freeShippingCodeDiscount\": {\n \"appliesOnOneTimePurchase\": true,\n \"appliesOnSubscription\": true,\n \"appliesOncePerCustomer\": true,\n \"code\": \"<your-code>\",\n \"combinesWith\": {\n \"orderDiscounts\": true,\n \"productDiscounts\": true,\n \"shippingDiscounts\": true\n },\n \"customerSelection\": {\n \"all\": true,\n \"customerSegments\": {\n \"add\": [\n \"gid://shopify/<objectName>/10079785100\"\n ],\n \"remove\": [\n \"gid://shopify/<objectName>/10079785100\"\n ]\n },\n \"customers\": {\n \"add\": [\n \"gid://shopify/<objectName>/10079785100\"\n ],\n \"remove\": [\n \"gid://shopify/<objectName>/10079785100\"\n ]\n }\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 \"usageLimit\": 1\n },\n \"id\": \"gid://shopify/<objectName>/10079785100\"\n}"
Schema Reference for MUTATION: discountCodeFreeShippingUpdate
"input DiscountCodeFreeShippingInput {\n appliesOnOneTimePurchase: Boolean\n appliesOnSubscription: Boolean\n appliesOncePerCustomer: Boolean\n code: String\n combinesWith: DiscountCombinesWithInput\n customerSelection: DiscountCustomerSelectionInput\n destination: DiscountShippingDestinationSelectionInput\n endsAt: DateTime\n maximumShippingPrice: Decimal\n minimumRequirement: DiscountMinimumRequirementInput\n recurringCycleLimit: Int\n startsAt: DateTime\n title: String\n usageLimit: Int\n}\n\ninput DiscountCombinesWithInput {\n orderDiscounts: Boolean\n productDiscounts: Boolean\n shippingDiscounts: Boolean\n}\n\ninput DiscountCustomerSelectionInput {\n all: Boolean\n customerSegments: DiscountCustomerSegmentsInput\n customers: DiscountCustomersInput\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: discountCodeFreeShippingUpdate
[ { "example": { "type_name": "discountcodefreeshippingupdate", "title": "Update a free shipping discount code", "description": "Update the minimum subtotal requirement to 25 USD, make it valid for the first week of August, and update the discount's code.\n", "query_string": "mutation discountCodeFreeShippingUpdate($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!, $id: ID!) {\n discountCodeFreeShippingUpdate(freeShippingCodeDiscount: $freeShippingCodeDiscount, id: $id) {\n codeDiscountNode {\n id\n codeDiscount {\n ... on DiscountCodeFreeShipping {\n title\n startsAt\n endsAt\n minimumRequirement {\n ... on DiscountMinimumSubtotal {\n greaterThanOrEqualToSubtotal {\n amount\n currencyCode\n }\n }\n }\n codes(first: 2) {\n nodes {\n code\n }\n }\n }\n }\n }\n userErrors {\n field\n code\n message\n }\n }\n}", "variables": { "freeShippingCodeDiscount": { "code": "FRSHP25", "minimumRequirement": { "subtotal": { "greaterThanOrEqualToSubtotal": 25 } }, "startsAt": "2022-08-01", "endsAt": "2022-08-08", "title": "Free shipping for orders above $25" }, "id": "gid://shopify/DiscountCodeFreeShipping/445378512" }, "response": { "data": { "discountCodeFreeShippingUpdate": { "codeDiscountNode": { "id": "gid://shopify/DiscountCodeNode/445378512", "codeDiscount": { "title": "Free shipping for orders above $25", "startsAt": "2022-08-01T00:00:00Z", "endsAt": "2022-08-08T00:00:00Z", "minimumRequirement": { "greaterThanOrEqualToSubtotal": { "amount": "25.0", "currencyCode": "USD" } }, "codes": { "nodes": [ { "code": "FRSHP25" } ] } } }, "userErrors": [] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/pricing/test/unit/graph_api/admin/mutations/discount_code_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 discountCodeFreeShippingUpdate($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!, $id: ID!) { discountCodeFreeShippingUpdate(freeShippingCodeDiscount: $freeShippingCodeDiscount, id: $id) { codeDiscountNode { id codeDiscount { ... on DiscountCodeFreeShipping { title startsAt endsAt minimumRequirement { ... on DiscountMinimumSubtotal { greaterThanOrEqualToSubtotal { amount currencyCode } } } codes(first: 2) { nodes { code } } } } } userErrors { field code message } } }\",\n \"variables\": {\n \"freeShippingCodeDiscount\": {\n \"code\": \"FRSHP25\",\n \"minimumRequirement\": {\n \"subtotal\": {\n \"greaterThanOrEqualToSubtotal\": 25.0\n }\n },\n \"startsAt\": \"2022-08-01\",\n \"endsAt\": \"2022-08-08\",\n \"title\": \"Free shipping for orders above $25\"\n },\n \"id\": \"gid://shopify/DiscountCodeFreeShipping/445378512\"\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation discountCodeFreeShippingUpdate($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!, $id: ID!) {\n discountCodeFreeShippingUpdate(freeShippingCodeDiscount: $freeShippingCodeDiscount, id: $id) {\n codeDiscountNode {\n id\n codeDiscount {\n ... on DiscountCodeFreeShipping {\n title\n startsAt\n endsAt\n minimumRequirement {\n ... on DiscountMinimumSubtotal {\n greaterThanOrEqualToSubtotal {\n amount\n currencyCode\n }\n }\n }\n codes(first: 2) {\n nodes {\n code\n }\n }\n }\n }\n }\n userErrors {\n field\n code\n message\n }\n }\n }`,\n {\n variables: {\n \"freeShippingCodeDiscount\": {\n \"code\": \"FRSHP25\",\n \"minimumRequirement\": {\n \"subtotal\": {\n \"greaterThanOrEqualToSubtotal\": 25.0\n }\n },\n \"startsAt\": \"2022-08-01\",\n \"endsAt\": \"2022-08-08\",\n \"title\": \"Free shipping for orders above $25\"\n },\n \"id\": \"gid://shopify/DiscountCodeFreeShipping/445378512\"\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 discountCodeFreeShippingUpdate($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!, $id: ID!) {\n discountCodeFreeShippingUpdate(freeShippingCodeDiscount: $freeShippingCodeDiscount, id: $id) {\n codeDiscountNode {\n id\n codeDiscount {\n ... on DiscountCodeFreeShipping {\n title\n startsAt\n endsAt\n minimumRequirement {\n ... on DiscountMinimumSubtotal {\n greaterThanOrEqualToSubtotal {\n amount\n currencyCode\n }\n }\n }\n codes(first: 2) {\n nodes {\n code\n }\n }\n }\n }\n }\n userErrors {\n field\n code\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"freeShippingCodeDiscount\": {\n \"code\": \"FRSHP25\",\n \"minimumRequirement\": {\n \"subtotal\": {\n \"greaterThanOrEqualToSubtotal\": 25.0\n }\n },\n \"startsAt\": \"2022-08-01\",\n \"endsAt\": \"2022-08-08\",\n \"title\": \"Free shipping for orders above $25\"\n },\n \"id\": \"gid://shopify/DiscountCodeFreeShipping/445378512\"\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 discountCodeFreeShippingUpdate($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!, $id: ID!) {\n discountCodeFreeShippingUpdate(freeShippingCodeDiscount: $freeShippingCodeDiscount, id: $id) {\n codeDiscountNode {\n id\n codeDiscount {\n ... on DiscountCodeFreeShipping {\n title\n startsAt\n endsAt\n minimumRequirement {\n ... on DiscountMinimumSubtotal {\n greaterThanOrEqualToSubtotal {\n amount\n currencyCode\n }\n }\n }\n codes(first: 2) {\n nodes {\n code\n }\n }\n }\n }\n }\n userErrors {\n field\n code\n message\n }\n }\n }`,\n \"variables\": {\n \"freeShippingCodeDiscount\": {\n \"code\": \"FRSHP25\",\n \"minimumRequirement\": {\n \"subtotal\": {\n \"greaterThanOrEqualToSubtotal\": 25.0\n }\n },\n \"startsAt\": \"2022-08-01\",\n \"endsAt\": \"2022-08-08\",\n \"title\": \"Free shipping for orders above $25\"\n },\n \"id\": \"gid://shopify/DiscountCodeFreeShipping/445378512\"\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 discountCodeFreeShippingUpdate($freeShippingCodeDiscount: DiscountCodeFreeShippingInput!, $id: ID!) {\n discountCodeFreeShippingUpdate(freeShippingCodeDiscount: $freeShippingCodeDiscount, id: $id) {\n codeDiscountNode {\n id\n codeDiscount {\n ... on DiscountCodeFreeShipping {\n title\n startsAt\n endsAt\n minimumRequirement {\n ... on DiscountMinimumSubtotal {\n greaterThanOrEqualToSubtotal {\n amount\n currencyCode\n }\n }\n }\n codes(first: 2) {\n nodes {\n code\n }\n }\n }\n }\n }\n userErrors {\n field\n code\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"freeShippingCodeDiscount\" => [\n \"code\" => \"FRSHP25\",\n \"minimumRequirement\" => [\n \"subtotal\" => [\n \"greaterThanOrEqualToSubtotal\" => 25.0,\n ],\n ],\n \"startsAt\" => \"2022-08-01\",\n \"endsAt\" => \"2022-08-08\",\n \"title\" => \"Free shipping for orders above $25\",\n ],\n \"id\" => \"gid://shopify/DiscountCodeFreeShipping/445378512\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "freeShippingCodeDiscount", "description": "The input data used to update the code discount.", "type": { "kind": "INPUT_OBJECT", "name": "DiscountCodeFreeShippingInput", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "DiscountCodeFreeShippingInput!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "freeShippingCodeDiscount", "argValue": " {\"code\":\"FRSHP25\",\"minimumRequirement\":{\"subtotal\":{\"greaterThanOrEqualToSubtotal\":25}},\"startsAt\":\"2022-08-01\",\"endsAt\":\"2022-08-08\",\"title\":\"Free shipping for orders above $25\"}", "typeKind": "MUTATION" }, { "arg": { "name": "id", "description": "The ID of the code 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/DiscountCodeFreeShipping/445378512\"", "typeKind": "MUTATION" } ] } ]