POS UI Extension Read Customer and Product Tags

Hi: I’m creating a POS UI Extension and I need to be able to read customer and product tags from the extension. I need to access the Admin Api. Is there a way to do this?

Thanks,

Luis

Hi: I’m creating a POS UI Extension and I need to be able to read customer and product tags from the extension. I need to access the Admin Api. Is there a way to do this?

Thanks,

Luis

2 Likes

Hello Luis,

I faced the same issue as you and finally found a solution.

First of all, you need to have your own backend. At the moment of writing this comment, Shopify does not provide a native extension solution to read customers (with product tags you can use the product search api https://shopify.dev/docs/api/pos-extensions/ui-extensions-reference/api/product-search).

For customers, just create in your backend an endpoint to gather shopify’s information via rest or via graphql.

Once you have your own backend, you simply have to fetch any endpoint developed to gather the information you need. To do so, the fetch must be secure, this means getting a valid session token and include it in the fetch headings under ‘Authentication’. To get the session token from the extension you can use the session api (https://shopify.dev/docs/api/pos-extensions/ui-extensions-reference/api/session).

Hope this helps.

Hi Dsn!

If I understood Luis’ question, he needs to get access to the customer that the staff selected in the POS. Do you know how to do that? I am facing the same problem here.

Thanks

Hello Fabien,

At the time of this answer, Shopify does not provide any POS UI Extensions API to access customer data. So you have to build it yourself.

As I told Luis, the only way I found to get that information in my app is developing a custom backend connected to my Shopify account (in my case I developed a Node server with Express) and make the API calls from your extension to your custom API. This API will gather the information from Shopify and return it to your app.

You can find the information of the Shopify Provided APIs here:

https://shopify.dev/docs/api/pos-extensions/ui-extensions-reference

Regards.

Thanks @dsn for your answer but I think I am still missing something.

I need to get the customer selected by the staff member in the POS like in this video: https://drive.google.com/file/d/1W9FXsxTYEkx3M4eiDHKrIheVG8b2E1cr/view

(not sure I made myself clear in my previous comment)

The only way I found to get the customer ID is by using the Product card recommendation extension or the Cart app extension.

I don’t understand what kind of API request you suggest making from the POS UI extension to get the customer.

Sorry, not sure if I understand your issue. Using the Cart API (not the Cart app extension) documented here: https://shopify.dev/docs/api/pos-extensions/ui-extensions-reference you will get a cart object in which you will find the customer id.

Sorry, the misunderstanding is mine :sweat_smile: .

At first, I tried to get the customer using this code :

const api = useExtensionApi();
console.log("customer", api.cart.customer);

But I had to access the customer using this code:

api.cart.subscribable.subscribe((cart) => {
    console.log('Customer', cart.customer);
});

Thanks a lot for your help!

Maybe you are developing a POS Link app or Cart App Extension app instead of a POS UI Extension app? useExtensionAPI() is only available in this third type.