Get the POS location ID as a part of the POS link

Hey,

We have a POS link handler, and we want to get the POS location ID as a part of the target URL, is this functionality possible?

1 Like

Hi @urigrise

I’ve read your question carefully, and I see that you’re trying to extract the POS location ID as part of the target URL when handling a POS link. I’ll break it down and provide the best approach to achieve this.

Understanding the Issue

Shopify’s POS system assigns a unique Location ID to each physical store or sales point. If you need to retrieve this ID dynamically within a URL, the main challenge is whether Shopify’s system exposes this information within the POS app’s link structure.

Possible Solution

Yes, you can retrieve the Location ID dynamically, but Shopify’s API doesn’t automatically append it to POS links. Instead, you’ll need to:

1-Use Shopify’s API to get the location ID:

If you’re working with the Shopify Admin API, use this endpoint:

GET /admin/api/2024-01/locations.json

  • This will return all your locations with their respective IDs.

2-Extract the Location ID dynamically from the Shopify POS environment:- If your POS app is embedded, you can use Shopify.App Bridge to fetch the current location.

  • Alternatively, you can detect the location ID from transactions by checking the order object inside Shopify POS.

3-Manually append the Location ID to your link:

If you’re generating a URL dynamically, you can structure it like this:

https://your-pos-app.com/?location_id=XXXXXXXXXX

  • Replace XXXXXXXXXX with the actual Location ID retrieved from the API.

Key Considerations- If you’re using Shopify POS embedded apps, make sure to request read_locations permission when setting up your API credentials.

  • If you’re linking from a button within Shopify POS, consider Shopify POS UI Extensions to fetch the location ID dynamically.

Let me know if you need further clarification or examples!
Best regards,
Daisy.