Storefront API: Get product details from barcode

New Member
3 0 0

Hi,

I am developing a mobile APP in Angular Js using storefront API. I want to create a simple search field where customer can enter the barcode of the product and it returns product details like product price description etc.

 

The physical store has thousands of products and this simple mobile app will let customers to get product price without going to POS counter.

 

I am aware of store front API getProductByID function that is availble in angular example on github. But what will be the best way (least resource expensive way) to get product details by Product barcode. In the store itself the Barcodes are saved in

Barcode (ISBN, UPC, GTIN, etc.) field.
 
Can anyone please point me to the correct direction.
 
Thank you.
A.
0 Likes
New Member
3 0 0

Anyone?

0 Likes
Shopify Staff
Shopify Staff
1369 56 202

While you cannot query on the barcode over the storefront API, you can use the Admin GraphQL API's query argument to search on bar code. https://help.shopify.com/en/api/graphql-admin-api/reference/queryroot

 

I'm not sure why you can't do this via the storefront API seeing how that property of the product is surfaced there, so I'll talk to some teams about perhaps implementing that improvement if it makes sense.

 

Cheers.

0 Likes
New Member
3 0 0
Hi Alex
The problem is querying the shopify data publically through an external app. Doing this via admin api gives CORS error as the origin of the request isn't similar to the shopify. Also it is insecure. So can you point me in the right direction regarding external apps.
Thanks
0 Likes
Highlighted
Shopify Staff
Shopify Staff
1369 56 202

While using the admin API directly via the client would be insecure, you could delegate to your backend to make the requests with client-side javascript. The response from your backend can be the forwarded response from the admin API. Would that work better for you?

 

Cheers.

0 Likes