Searching for product by barcode in POS UI Extension

Topic summary

A developer is building a custom POS UI extension app that uses the CameraScanner and useScannerDataSubscription to capture barcode data. However, the built-in ProductSearch library doesn’t support searching products by barcode.

Available methods like api.productSearch.fetchProductVariantWithId() and api.productSearch.searchProducts() don’t accept barcode parameters. The documentation incorrectly assumes barcodes match variant IDs, which isn’t true—especially when using Shopify’s Retail Barcode Labels app that generates barcodes from only the last 6 digits of the variant ID.

Current workaround: Create a custom external endpoint to handle barcode-to-product lookups, either by calling the Admin API or implementing a dedicated API endpoint.

Status: The issue remains unresolved. A second user encountered the same problem, and the original poster confirmed no native solution exists yet, though external API calls via fetch are now easier to implement.

Summarized with AI on October 23. AI used: claude-sonnet-4-5-20250929.

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

Hi @phy9pas,

Did you ever find a solution for this? I’ve run into the same problem…

Cheers,

Joe

I’m afraid I don’t think there is a good solution for this yet.

I think they have made it a bit easier now to make external requests with fetch so you could either call the admin api, or implement your own api endpoint to lookup the products by barcode and return the data you need.