Re: Add address to orders that do not require shipping

Solved

Add address to orders that do not require shipping

lpearson
Visitor
1 0 1

We are trying to create a flow that will add our address to orders that do not require shipping (ex. digital gift cards). Within our order management system, addresses are required for all orders and without an address, these are getting hung up.

 

Does anyone know how to do this?

Accepted Solution (1)
paul_n
Shopify Staff
1343 151 311

This is an accepted solution.

Some more details. Here's what my workflow looks like:

 

Here's the query that you would use:

 

"query": "mutation orderUpdate($input: OrderInput!) {\n orderUpdate(input: $input) {\n order {\n id }\n userErrors {\n field message }\n }\n }", "variables": { "input": { "id": "{{ order.id }}", "shippingAddress": { "lastName":"TestLastName", "zip":"19086", "address1":"123 fake way", "city":"Wallingford", "province":"Pennsylvania", "provinceCode":"PA", "country":"United States" } } } }

 

This exact query does work. To change the address, most of the fields I've included are required, but it's hard to tell from the docs (you can't just add a zip for example). 

 

The API token can be generated by creating a custom app your Admin. Go to Settings / Apps and sales channels / Develop apps. You need read/write orders scopes.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 10 (10)

oeban31
New Member
7 0 0

Same here! WMS won't let us pull in order unless it has a shipping address value. Prevents us from tracking our retail (POS) store inventory.

paul_n
Shopify Staff
1343 151 311

You could use Send HTTP Request to call this API: https://shopify.dev/docs/api/admin-graphql/2023-04/mutations/orderUpdate

 

There is an option to change the Shipping Address

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
paul_n
Shopify Staff
1343 151 311

This is an accepted solution.

Some more details. Here's what my workflow looks like:

 

Here's the query that you would use:

 

"query": "mutation orderUpdate($input: OrderInput!) {\n orderUpdate(input: $input) {\n order {\n id }\n userErrors {\n field message }\n }\n }", "variables": { "input": { "id": "{{ order.id }}", "shippingAddress": { "lastName":"TestLastName", "zip":"19086", "address1":"123 fake way", "city":"Wallingford", "province":"Pennsylvania", "provinceCode":"PA", "country":"United States" } } } }

 

This exact query does work. To change the address, most of the fields I've included are required, but it's hard to tell from the docs (you can't just add a zip for example). 

 

The API token can be generated by creating a custom app your Admin. Go to Settings / Apps and sales channels / Develop apps. You need read/write orders scopes.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
paul_n
Shopify Staff
1343 151 311

Just to round out this answer, if you change the URL to what REST requires and method to "PUT", the REST order update is a bit easier to read.

URL:

https://YOURSTORE.myshopify.com/admin/api/2023-04/orders/{{ order.legacyResourceId }}.json

 

Body:

{"order":{"id":{{ order.legacyResourceId }},"shipping_address":{"address1":"123 Flow Street","city":"Shipsville"}}}

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
anirudh96
Tourist
3 0 1

What will be the Metafield namespace and the key? I'm finding it hard to get the codes for those

paul_n
Shopify Staff
1343 151 311

What namespace and key? I don't see them referenced above

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
anirudh96
Tourist
3 0 1

No i see how the value is entered. How do i frame/create the namespace and key. This is integral part as the shipping address cannot be empty, when the order ingests into our ERP system(Fishbowl) it gives us an API error. So I need the shipper address to be our warehouse address for pick-up orders.

dpnz1
Visitor
3 0 0

Hi Paul,


I've managed to follow your steps and get a successful flow setup, however it doesn't seem to actually update the shipping address details on the order at all.

The flow just confirms that the HTTP request succeeded. Upon checking the order shipping address, it's still blank?

Do you have any ideas why it would not update?

paul_n
Shopify Staff
1343 151 311

Usually if it says it succeeded the API call was at least valid but might have been missing data or something like that. 

 

You can double-check that your code is outputting what you expect by using "Log Output" with the exact same text you put in the body. 

 

Also, have you tested the same API call in a tool like Postman? That may give you more detail on what error is happening. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
dpnz1
Visitor
3 0 0

I wasn't too sure how to get the Log Output to display any useful information about the query, however I switched the your second suggestion of using REST PUT instead and it's all working, thanks!