Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

Get Location Id of the item in order information

Alex_Beacon
Shopify Partner
24 0 3

Hi Shopify Team,

I'm a developer of the app.

I want to my system be able to cancel the order and make a refund automatically after webhook for "orders/create" were triggered.

How can I refund the order? Cause Shopify API documenation says that I need to specify the location_id of the items that were in that order (location_id is required).  
So how can I get these location_ids ?

Thanks,
Alex

Decrease fraudulent orders, stop chargebacks and expand globally with Beacon. https://apps.shopify.com/beacon
Replies 2 (2)

Josh
Shopify Staff
1134 84 233

Hey Alex, 

 

To get potential location_ids for a refund, there are GraphQL and REST examples in our guide here.

 

While the guide is for updating inventory, the same steps still apply for retrieving a location_id - you'll just only need the 'Step 1' and 'Step 2' parts. 

Josh | Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

JoesIdeas
Shopify Expert
2121 191 564

Hi @Josh I'm trying to do the same thing. Was able to get potential location ID's, but do you know how to get the location ID that Shopify assigns?

Example: When you look at the order details page, you see a location for each line item. How do you get that location that shows in the line item in the orders page?

• Creator of Order Automator (automate tagging, fulfillment, Amazon, notifications + more)
• Shopify developer for 10+ years, store owner for 7 years
• I also make guides like Shopify Automation Tips and How to Deal with Fraud / Chargebacks