Skip to main content

Product Search API

The Product Search API provides access to POS native product search functionality, allowing you to search for products, fetch product details, and retrieve product variants with pagination support and flexible sorting options. The API enables both text-based search and direct product lookups by ID.

  • Search interfaces: Implement custom product search with advanced filtering and sorting.
  • Recommendations: Build product recommendation systems based on search results.
  • Inventory lookup: Create inventory tools that lookup product details and variant information.
  • Upselling: Develop upselling and cross-selling features by searching for complementary products.
Support
Targets (28)

The shopify global object provides product search and lookup methods. Access the following properties on shopify to search for products, fetch product details, and retrieve product variants.

Anchor to fetchPaginatedProductVariantsWithProductId
fetchPaginatedProductVariantsWithProductId
(productId: number, paginationParams: ) => Promise<<>>
required

Retrieves product variants for a specific product with pagination support. Use when a product has many variants and you need to load them incrementally for better performance. Ideal for products with extensive variant collections that would be too large to load at once.

Anchor to fetchProductsWithIds
fetchProductsWithIds
(productIds: number[]) => Promise<<>>
required

Retrieves detailed information for multiple products by their IDs. Limited to 50 products maximum—additional IDs are automatically removed. Returns results with both found and not found products clearly identified. Use for bulk product lookups, building product collections, or validating product lists.

Anchor to fetchProductVariantsWithIds
fetchProductVariantsWithIds
(productVariantIds: number[]) => Promise<<>>
required

Retrieves detailed information for multiple product variants by their IDs. Limited to 50 variants maximum—additional IDs are automatically removed. Returns results with both found and not found variants clearly identified. Use for bulk variant lookups or building variant-specific collections.

Anchor to fetchProductVariantsWithProductId
fetchProductVariantsWithProductId
(productId: number) => Promise<[]>
required

Retrieves all product variants associated with a specific product ID. Returns all variants at once without pagination. Use for displaying complete variant options, building variant selectors, or analyzing all available configurations for a product.

Anchor to fetchProductVariantWithId
fetchProductVariantWithId
(productVariantId: number) => Promise<>
required

Retrieves detailed information for a single product variant by its ID. Returns undefined if the variant doesn't exist or isn't available. Use for displaying variant-specific details like pricing, inventory, or options when working with specific product configurations.

Anchor to fetchProductWithId
fetchProductWithId
(productId: number) => Promise<>
required

Retrieves detailed information for a single product by its ID. Returns undefined if the product doesn't exist or isn't available on the POS device. Use for displaying product details, validating product availability, or building product-specific workflows.

Anchor to searchProducts
searchProducts
(searchParams: ) => Promise<<>>
required

Searches for products on the POS device using text queries and sorting options. Returns paginated results with up to 50 products per page. When a query string is provided, results are sorted by relevance. Use for implementing custom search interfaces, product discovery features, or filtered product listings.


  • Implement efficient pagination: Use appropriate page sizes and cursor-based pagination to balance performance with user experience, especially for large product catalogs.
  • Handle search results gracefully: Check for undefined results and empty result sets.
  • Optimize search performance: Consider caching frequently accessed product data and implementing debounced search to reduce API calls while users are typing search queries.
  • Provide relevant search options: Use appropriate sorting options based on your use case - relevance for user searches, alphabetical for browsing, or recently added for highlighting new products.

  • Product search results are limited to products available on the current POS device and may not include the complete shop catalog if products aren't synced locally.
  • Bulk operations (fetchProductsWithIds and fetchProductVariantsWithIds) are limited to 50 items maximum, with additional IDs automatically removed from requests.

Was this page helpful?