Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
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?
Solved! Go to the solution
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.
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.
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
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.
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"}}}
What will be the Metafield namespace and the key? I'm finding it hard to get the codes for those
What namespace and key? I don't see them referenced above
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.
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?
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.
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!
We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024