> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: getRecommendation(algorithms: Array, options: GetRecommendationOptions) # Method package: wixEcomBackend # Method menu location: wixEcomBackend --> recommendations --> getRecommendation # Method Link: https://dev.wix.com/docs/velo/apis/wix-ecom-backend/recommendations/get-recommendation.md # Method Description: Returns a recommendation object containing a list of items to recommend to the customer. `getRecommendation()` determines which items to recommend based on the given recommendation algorithms. `getRecommendation()` doesn’t run the algorithms. It calls the installed apps that provide them. Apps may provide algorithms for use with their own catalogs, or for use with catalogs from other apps. For example, Wix Stores provides algorithms that can only be used on its own catalogs. To run an algorithm, the app providing it must be installed, and an app providing a supported catalog must be installed. For more information and to see which algorithms are available on your site or project, call [`listAvailableAlgorithms()`](#listavailablealgorithms). `getRecommendation()` operates as follows: 1. `getRecommendation()` receives as input a list of algorithms as an array. These algorithms can be provided by different apps and can apply to different catalogs. 2. `getRecommendation()` calls the app that corresponds to the `appId` of the first algorithm in the list of algorithms. It passes that algorithm’s ID and the IDs of any subsequent algorithms in the array for the same app. 3. The app runs the algorithms. 4. `getRecommendation()` returns items recommendations from the first algorithm (according to its position in the `algorithms` array) that meets the minimum number of recommendations. At that point `getRecommendation()` stops calling other apps. 5. If none of the algorithms run by the first app meet the minimum recommended items, `getRecommendation()` finds the next algorithm in the array with a new `appId` (an ID of an app that has not yet been called), and repeats the process. 6. If no algorithms in the `algorithms` array recommend at least the minimum recommended items, `getRecommendation()` returns an empty array. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Get recommendation with algorithms and options objects ```javascript /************************************** * Backend code - recommendations.web.js * *************************************/ import { Permissions, webMethod } from 'wix-web-module'; import { recommendations } from 'wix-ecom-backend'; export const getRecommendation = webMethod(Permissions.Anyone, async (algorithms, options) => { try { const result = await recommendations.getRecommendation(algorithms, options); return result; } catch (error) { console.error(error); // Handle the error } }); /************* * Page code * ************/ import { getRecommendation } from 'backend/recommendations.web'; $w.onReady(async function () { let algorithm = { appId: '215238eb-22a5-4c36-9e7b-e7c08025e04e', id: '68ebce04-b96a-4c52-9329-08fc9d8c1253' }; let item = { appId: '215238eb-22a5-4c36-9e7b-e7c08025e04e', catalogItemId: '11e2ffb7-2520-3c21-051e-1f05486b9061' }; let options = { items: [item], minimumRecommendedItems: 1 } let recommendations = await getRecommendation([algorithm], options); console.log(recommendations); }); ``` ---