Skip to main content
Signature

Import

To ensure optimal bundle sizes, see Optimize build size.
Vue

About this widget

Use the ais-frequently-bought-together widget to display a list of frequently bought together items. See also: Set up Algolia Recommend

Examples

Vue
To display the recommendations as a scrollable carousel, set the layout prop to carousel.
Vue

Props

string[]
required
The list of object IDs to get recommendations for. If you specify several object IDs, you’ll get a single set of aggregated results from the requests, ordered by their score.
Each objectID counts as one Recommend request, even when you pass multiple IDs in one array. For example, ["A", "B", "C"] counts as three requests and can affect your quota.
Vue
number
The number of recommendations to retrieve. Depending on the available recommendations and the other request parameters, the actual number of items may be lower than that. If you omit limit or set it to 0, the widget returns all matching recommendations.
Vue
number
The threshold for the recommendations confidence score (between 0 and 100). The widget only returns recommendations with a greater score.
Vue
Omit<SearchParameters, hitsPerPage | length | offset | page>
Search parameters to apply to the recommendation request.
Vue
Omit<SearchParameters, hitsPerPage | length | offset | page>
List of search parameters to send as an extra set when there aren’t enough recommendations.
Vue
boolean
default:true
Whether to escape HTML tags from recommendations string values.
Vue
function
default:"items => items"
A function to transform or reorder recommendations before the widget displays them. It returns an array of items with the same structure.
To prevent creating infinite loops, avoid passing arrays, objects, or functions directly in the template. These values aren’t referentially equal on each render, which causes the widget to re-register every time. Instead, define them in your component’s data option and reference them in the template.
Vue
'list' | 'carousel'
default:"'list'"
How to display the recommendations:
  • list. A list of items.
  • carousel. A horizontally scrollable carousel with “Previous” and “Next” navigation buttons.
The item slot applies to both layouts.
Vue
object
default:"{}"
The CSS classes you can override:
  • ais-FrequentlyBoughtTogether. The widget’s root element.
  • ais-FrequentlyBoughtTogether--empty. The root element without results.
  • ais-FrequentlyBoughtTogether-title. The widget’s title element.
  • ais-FrequentlyBoughtTogether-container. The container of the list element.
  • ais-FrequentlyBoughtTogether-list. The list of recommendations.
  • ais-FrequentlyBoughtTogether-item. The list item.
With the carousel layout, the ais-FrequentlyBoughtTogether-list and ais-FrequentlyBoughtTogether-item classes apply to the carousel’s list and items.
Vue

Customize the UI

The slot to override the complete DOM output of the widget. The widget only uses this slot if you don’t provide any other slot.Scope
  • items: object[]. The recommendations.
  • sendEvent: (eventType, hit, eventName) => void. The function to send click or conversion events.
Vue
The slot to override the DOM output of each recommendation. If you don’t provide it, the widget displays the recommendation as a JSON string.Scope
  • item: object. A single recommendation with all its attributes.
  • sendEvent: (eventType, hit, eventName) => void. The function to send click or conversion events.
Vue
The slot to override the DOM output of the title header. The widget doesn’t render the header when there are no recommendations. If you don’t provide it, the widget displays “Frequently bought together” as the title.Scope
  • items: object[]. The recommendations.
  • translations: object. The widget’s translations, such as title.
  • classNames: object. The widget’s CSS classes, such as title.
Vue
The slot to override the DOM output when there are no recommendations. If you don’t provide it, the widget displays “No results”.
Vue

HTML output

HTML
Last modified on October 28, 2026