getConfig( )


Retrieves the configuration of your recommendations plugin.

Set your recommendations configuration in the return of the getConfig() function. Wix calls this function when you publish your site. Changes to the configuration don't take effect until you publish your site.

getConfig() returns an object containing the values used to display the recommendations algorithms in the Related Products gallery settings in the editor.

Where to find getConfig()

When you add the Recommendations service plugin, a folder is automatically added to your site. Use the -config.js file in the folder to set the default configuration for your implementation of the service plugin.

For more information on setting your configuration, see Recommendations Service Plugin.

Method Declaration
Copy
function getConfig(): Promise<RecommendationsConfigResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<RecommendationsConfigResponse>
Example of a configuration file
JavaScript
// Place this code in the <my-plugin-name>-config.js file // in the 'ecom-recommendations-provider' folder of the // Custom Extensions section on your site. export function getConfig() { return { catalogAppIds: ["215238eb-22a5-4c36-9e7b-e7c08025e04e"], supportedAlgorithms: [ { algorithmId: "945a457f-0a57-4cf4-95a1-95991b545119", name: "In stock from the same category", description: "If selected product is out of stock, suggest in-stock products from the same category.", additionalInfo: "Works best on product page.", algorithmType: "RELATED_ITEMS", }, { algorithmId: "97f48eb2-4d42-4296-b620-13862dd0353e", name: "Cheapest in the store", description: "The cheapest products in the store", algorithmType: "GLOBAL", }, ], }; }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?