Get a list of all store Locations inside Checkout UI Extension

Get a list of all store Locations inside Checkout UI Extension

jamalali81
Shopify Partner
23 0 4

Is it possible to fetch all our store Locations from within a Checkout Ui Extension? I need to be able to set the location name where the order will be fulfilled from as an order attribute.

Replies 4 (4)

Liam
Shopify Staff
2873 312 821
Hi Jamalali81,
 
You should be able to fetch store locations from within a Checkout UI Extension using the Storefront API - specifically by using the `locations` query

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

jamalali81
Shopify Partner
23 0 4

Thanks @Liam! I did try that but it doesn't return any results. According to the docs this is a "List of the shop's locations that support in-store pickup." I need to be able to fetch all locations, not just those that support in-store pickup.

Liam
Shopify Staff
2873 312 821

Hi again Jamalali,

 

You could try setting up an approach where you access the locations API (which would return a list of active inventory locations) with a backend service and then from within the Checkout UI Extension, you could make AJAX/fetch requests to your backend service to fetch location info. 

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

TonioLHG
Shopify Partner
2 0 0

Hi Liam, 

From within a Checkout UI Extension, is it possible to retrieve the locations used to fulfilled the current order? 

 

Thank you!