Vue Storefront is now Alokai! Learn More
Usage

Usage

The unified extension provides two endpoints: searchProducts for searching and browsing, and getProductDetails for individual product pages. Both return normalized Unified Data Model types that work across all Alokai integrations.

For a complete list of all parameters and response types, see the Reference.

Searching Products

The simplest search returns products matching a query:

const { products, facets, pagination } = await sdk.bloomreachUnified.searchProducts({
  search: 'running shoes',
});

To browse a category instead of searching, pass category:

const { products, facets, pagination } = await sdk.bloomreachUnified.searchProducts({
  category: 'electronics/laptops',
  pageSize: 12,
});

Filtering by facets

Pass facet values as a record of field name to selected values. By default, multiple values within a facet are combined with OR (matches any). You can change this to AND via facetFilterOperator in your config.

const results = await sdk.bloomreachUnified.searchProducts({
  search: 'shoes',
  facets: {
    colors: ['red', 'blue'],
    sizes: ['42', '43'],
  },
});

Sorting

Pass a sort expression as sortBy. When currencies are configured, price sorting automatically uses the currency-specific field (e.g. price_eur desc). Omit sortBy entirely for relevance-based sorting.

const results = await sdk.bloomreachUnified.searchProducts({
  search: 'shoes',
  sortBy: 'price asc',
});

Pagination

Control page size and current page. The response includes everything you need for navigation.

const results = await sdk.bloomreachUnified.searchProducts({
  search: 'shoes',
  pageSize: 20,
  currentPage: 2,
});

const { currentPage, pageSize, totalPages, totalResults } = results.pagination;

Per-request filters

You can override the static efq filter from your config on a per-request basis, and pass a userId for Bloomreach personalization:

const results = await sdk.bloomreachUnified.searchProducts({
  search: 'shoes',
  efq: 'availability:"In Stock" AND brand:"Nike"',
  userId: 'customer-123',
});

Getting Product Details

Fetch a single product with its variants and category breadcrumb:

const { product, categoryHierarchy } = await sdk.bloomreachUnified.getProductDetails({
  id: 'product-123',
});

The response gives you everything needed for a product detail page — name, price, gallery images, description, variants with their attributes, and the full category path from root to the product's category.

product.name;          // Product title
product.price;         // SfDiscountablePrice with regular and special prices
product.gallery;       // SfImage[] from the product and its variants
product.variants;      // SfProduct[] with variant-specific attributes

categoryHierarchy;     // SfCategory[] ordered from root to leaf

Response Types

Both endpoints return the same SfProduct*, SfFacet, and SfPagination types as every other Alokai integration (SAP Commerce Cloud, commercetools, etc.). This means storefront components built for any backend work with Bloomreach Discovery without changes.