yarn add @pinelab/vendure-plugin-popularity-scores
to install this plugin.
yarn add @pinelab/vendure-plugin-popularity-scores
to install this plugin.
Sort products and categories by popularity based on previously placed orders.
This plugin periodically scores products and categories based on the amount of times they occur in previously placed orders. The goal is to be able to order products and categories by their popularity, so we can present the most popular products and categories to our customers first.
import { PopularityScoresPlugin } from 'vendure-plugin-popularity-scores'
...
plugins: [
PopularityScoresPlugin.init({
endpointSecret: 'test',
}),
...
];
This plugin exposes an endpoint that can be periodically called: /popularity-scores/:yourchanneltoken/:yoursecret
. This will push a job named calculate-popularity
to the worker. The worker will handle this message and do the following:
Product.customFields.popularityScore
Collection.customFields.popularityScore
Run yarn start
to start the server. The following will be available after startup:
http://localhost:3050/admin
you can login with superadmin/superadminhttp://localhost:3050/admin-api
Admin GraphQL playgroundhttp://localhost:3050/shop-api
Shop GraphQL playgroundRun yarn test
to run the testcases defined in test/e2e.spec.ts