Anchor to deliveryProfileUpdatedelivery
deliveryProfileUpdate
mutation
Requires Any of shipping
access scopes or user permission.
Update a delivery profile.
Anchor to Arguments
Arguments
- •ID!required
The ID of the delivery profile to update.
- Anchor to leaveLegacyModeProfilesleave•
Legacy Mode Profiles Whether this delivery profile should leave legacy mode.
- Anchor to profileprofile•Delivery
Profile requiredInput! Specifies the input fields for a delivery profile.
Was this section helpful?
Anchor to DeliveryProfileUpdatePayload returnsDeliveryProfileUpdatePayload returns
- Anchor to profileprofile•
The delivery profile that was updated.
- Anchor to userErrorsuser•
Errors [UserError!]! non-null The list of errors that occurred from executing the mutation.
Was this section helpful?
- Update delivery profile to add a location and a zone to an existing group
- Update delivery profile to add a location group
- deliveryProfileUpdate reference
Examples
1const { admin } = await authenticate.admin(request);23const response = await admin.graphql(4 `#graphql5 mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {6 deliveryProfileUpdate(id: $id, profile: $profile) {7 profile {8 id9 name10 profileLocationGroups {11 locationGroup {12 id13 locations(first: 5) {14 nodes {15 name16 address {17 country18 }19 }20 }21 }22 locationGroupZones(first: 2) {23 edges {24 node {25 zone {26 id27 name28 countries {29 code {30 countryCode31 }32 provinces {33 code34 }35 }36 }37 }38 }39 }40 }41 }42 userErrors {43 field44 message45 }46 }47 }`,48 {49 variables: {50 "id": "gid://shopify/DeliveryProfile/593363170",51 "profile": {52 "name": "Sample Updated Delivery Profile",53 "locationGroupsToUpdate": [54 {55 "id": "gid://shopify/DeliveryLocationGroup/955592432",56 "locationsToAdd": [57 "gid://shopify/Location/884687543"58 ],59 "zonesToCreate": [60 {61 "name": "USA Zone",62 "countries": {63 "code": "US",64 "provinces": [65 {66 "code": "CO"67 }68 ]69 },70 "methodDefinitionsToCreate": [71 {72 "name": "Standard",73 "rateDefinition": {74 "price": {75 "amount": 1.0,76 "currencyCode": "USD"77 }78 }79 }80 ]81 }82 ]83 }84 ]85 }86 },87 },88);8990const data = await response.json();91
mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {
deliveryProfileUpdate(id: $id, profile: $profile) {
profile {
id
name
profileLocationGroups {
locationGroup {
id
locations(first: 5) {
nodes {
name
address {
country
}
}
}
}
locationGroupZones(first: 2) {
edges {
node {
zone {
id
name
countries {
code {
countryCode
}
provinces {
code
}
}
}
}
}
}
}
}
userErrors {
field
message
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) { deliveryProfileUpdate(id: $id, profile: $profile) { profile { id name profileLocationGroups { locationGroup { id locations(first: 5) { nodes { name address { country } } } } locationGroupZones(first: 2) { edges { node { zone { id name countries { code { countryCode } provinces { code } } } } } } } } userErrors { field message } } }",
"variables": {
"id": "gid://shopify/DeliveryProfile/593363170",
"profile": {
"name": "Sample Updated Delivery Profile",
"locationGroupsToUpdate": [
{
"id": "gid://shopify/DeliveryLocationGroup/955592432",
"locationsToAdd": [
"gid://shopify/Location/884687543"
],
"zonesToCreate": [
{
"name": "USA Zone",
"countries": {
"code": "US",
"provinces": [
{
"code": "CO"
}
]
},
"methodDefinitionsToCreate": [
{
"name": "Standard",
"rateDefinition": {
"price": {
"amount": 1.0,
"currencyCode": "USD"
}
}
}
]
}
]
}
]
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {
deliveryProfileUpdate(id: $id, profile: $profile) {
profile {
id
name
profileLocationGroups {
locationGroup {
id
locations(first: 5) {
nodes {
name
address {
country
}
}
}
}
locationGroupZones(first: 2) {
edges {
node {
zone {
id
name
countries {
code {
countryCode
}
provinces {
code
}
}
}
}
}
}
}
}
userErrors {
field
message
}
}
}`,
{
variables: {
"id": "gid://shopify/DeliveryProfile/593363170",
"profile": {
"name": "Sample Updated Delivery Profile",
"locationGroupsToUpdate": [
{
"id": "gid://shopify/DeliveryLocationGroup/955592432",
"locationsToAdd": [
"gid://shopify/Location/884687543"
],
"zonesToCreate": [
{
"name": "USA Zone",
"countries": {
"code": "US",
"provinces": [
{
"code": "CO"
}
]
},
"methodDefinitionsToCreate": [
{
"name": "Standard",
"rateDefinition": {
"price": {
"amount": 1.0,
"currencyCode": "USD"
}
}
}
]
}
]
}
]
}
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `mutation deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {
deliveryProfileUpdate(id: $id, profile: $profile) {
profile {
id
name
profileLocationGroups {
locationGroup {
id
locations(first: 5) {
nodes {
name
address {
country
}
}
}
}
locationGroupZones(first: 2) {
edges {
node {
zone {
id
name
countries {
code {
countryCode
}
provinces {
code
}
}
}
}
}
}
}
}
userErrors {
field
message
}
}
}`,
"variables": {
"id": "gid://shopify/DeliveryProfile/593363170",
"profile": {
"name": "Sample Updated Delivery Profile",
"locationGroupsToUpdate": [
{
"id": "gid://shopify/DeliveryLocationGroup/955592432",
"locationsToAdd": [
"gid://shopify/Location/884687543"
],
"zonesToCreate": [
{
"name": "USA Zone",
"countries": {
"code": "US",
"provinces": [
{
"code": "CO"
}
]
},
"methodDefinitionsToCreate": [
{
"name": "Standard",
"rateDefinition": {
"price": {
"amount": 1.0,
"currencyCode": "USD"
}
}
}
]
}
]
}
]
}
},
},
});
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 deliveryProfileUpdate($id: ID!, $profile: DeliveryProfileInput!) {
deliveryProfileUpdate(id: $id, profile: $profile) {
profile {
id
name
profileLocationGroups {
locationGroup {
id
locations(first: 5) {
nodes {
name
address {
country
}
}
}
}
locationGroupZones(first: 2) {
edges {
node {
zone {
id
name
countries {
code {
countryCode
}
provinces {
code
}
}
}
}
}
}
}
}
userErrors {
field
message
}
}
}
QUERY
variables = {
"id": "gid://shopify/DeliveryProfile/593363170",
"profile": {
"name": "Sample Updated Delivery Profile",
"locationGroupsToUpdate": [{"id"=>"gid://shopify/DeliveryLocationGroup/955592432", "locationsToAdd"=>["gid://shopify/Location/884687543"], "zonesToCreate"=>[{"name"=>"USA Zone", "countries"=>{"code"=>"US", "provinces"=>[{"code"=>"CO"}]}, "methodDefinitionsToCreate"=>[{"name"=>"Standard", "rateDefinition"=>{"price"=>{"amount"=>1.0, "currencyCode"=>"USD"}}}]}]}]
}
}
response = client.query(query: query, variables: variables)
Input variables
JSON1{2 "id": "gid://shopify/DeliveryProfile/593363170",3 "profile": {4 "name": "Sample Updated Delivery Profile",5 "locationGroupsToUpdate": [6 {7 "id": "gid://shopify/DeliveryLocationGroup/955592432",8 "locationsToAdd": [9 "gid://shopify/Location/884687543"10 ],11 "zonesToCreate": [12 {13 "name": "USA Zone",14 "countries": {15 "code": "US",16 "provinces": [17 {18 "code": "CO"19 }20 ]21 },22 "methodDefinitionsToCreate": [23 {24 "name": "Standard",25 "rateDefinition": {26 "price": {27 "amount": 1,28 "currencyCode": "USD"29 }30 }31 }32 ]33 }34 ]35 }36 ]37 }38}
Response
JSON1{2 "deliveryProfileUpdate": {3 "profile": {4 "id": "gid://shopify/DeliveryProfile/593363170",5 "name": "Sample Updated Delivery Profile",6 "profileLocationGroups": [7 {8 "locationGroup": {9 "id": "gid://shopify/DeliveryLocationGroup/955592432",10 "locations": {11 "nodes": [12 {13 "name": "Ottawa Store",14 "address": {15 "country": "Canada"16 }17 },18 {19 "name": "Ottawa Warehouse",20 "address": {21 "country": "Canada"22 }23 },24 {25 "name": "Shipping Origin",26 "address": {27 "country": "Canada"28 }29 }30 ]31 }32 },33 "locationGroupZones": {34 "edges": [35 {36 "node": {37 "zone": {38 "id": "gid://shopify/DeliveryZone/161697132",39 "name": "Canada",40 "countries": [41 {42 "code": {43 "countryCode": "CA"44 },45 "provinces": [46 {47 "code": "ON"48 }49 ]50 }51 ]52 }53 }54 },55 {56 "node": {57 "zone": {58 "id": "gid://shopify/DeliveryZone/1066475777",59 "name": "USA Zone",60 "countries": [61 {62 "code": {63 "countryCode": "US"64 },65 "provinces": [66 {67 "code": "CO"68 }69 ]70 }71 ]72 }73 }74 }75 ]76 }77 }78 ]79 },80 "userErrors": []81 }82}