Searching for product by barcode in POS UI Extension

phy9pas
Shopify Partner
2 0 0

I'm working on a custom app using the POS UI extension.

It's utilising the CameraScanner and 

useScannerDataSubscription

listener to get scanned barcode data.

I was really surprised to see that that ProductSearch library that comes with the POS UI extension doesn't seem to let you search for products by barcode.

I can use

api.productSearch.fetchProductVariantWithId()

or

api.productSearch.searchProducts()

but neither of these seem to allow you to search by barcode.

The example they use in the docs assumes that a product's barcode will be the same as its variantId, but this isn't necessarily the case - in fact if you use Shopify's own Retail Barcode Labels app then it will generate barcodes using only the last 6 digits of the variantId.

It seems like the only option is to create my own endpoint outside the app to take the barcode and return product variants.

Does anybody know if I've missed something here - it seems like quite an oversight that the barcode scanner functionality doesn't seem to let you do anything with the barcodes that are scanned.

Thanks

Pete

Replies 0 (0)