Vue Storefront is now Alokai! Learn More
Items

Items

This section will cover the basics of the items and how to fetch them

API Reference

You can find all available Bloomreach Discovery module methods and their description in the API Reference.

Fetching items by id

To fetch an item by id, you can use the findItemById method.

import { sdk } from '~/sdk'

const id = '4654916'
const item = await sdk.brd.findItemById({ id })

Fetching items by category

To fetch items by category, you can use the findItemsByCategory method.

import { sdk } from '~/sdk'

const data = await sdk.brd.findItemsByCategory({
  categoryId: 'PNB250864140000',
})

const items = data.items // results

Fetching items by keyword

To fetch items by keyword, you can use the findItemsByKeyword method.

import { sdk } from '~/sdk'

const data = await sdk.brd.findItemsByKeyword({
  text: 'Greenlee',
})

const items = data.items // results

Fetching items by widget

To fetch items by widget, you can use the findItemsByWidget method.

import { sdk } from '~/sdk'

const results = await sdk.brd.findItemsByWidget({
  text: 'bolts',
  queryHint: {
    widgetId: 'r926zmjv',
    widgetType: 'keyword',
    brUid2: 'some bruid2',
  },
})

const items = results.items // found items

Specifying fields

Each of the methods above allows to specify the fields that should be returned. To do so, define the expect property.

import { sdk } from '~/sdk'

const id = '4654916'
const item = await sdk.brd.findItemById({
  id,
  expect: `
   itemId {
    id
   }
 `,
})

Query hints

Each of the methods above allows to specify the query hints that should be used. To do so, define the queryHints property.

import { sdk } from '~/sdk'

const id = '4654916'
const item = await sdk.brd.findItemById({
  id,
  queryHint: {
    brUid2: 'some value',
  },
})