Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Get Location Id of the item in order information

Get Location Id of the item in order information

Alex_Beacon
Shopify Partner
26 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 235

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 Partner
2461 227 666

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 [auto tag, fulfill, connect FBA, daily jobs]
• Co-Creator of Product Automator [suite of features for products / collections]
• Shopify developer for 10+ years, store owner for 7 years
• Blog: Shopify Tips, Guides, and Automation Tactics