@haus-tech/product-popularity-plugin
v3.0.5
Published
Product popularity plugin for Vendure
Readme
name: product-popularity-plugin title: Product Popularity Plugin description: Vendure plugin designed to expose and query product popularity metrics in your e-commerce store. version: 3.0.0
Product Popularity Plugin
The Product Popularity Plugin is a Vendure plugin designed to expose and query the popularity of products in your e-commerce store. It provides a mechanism to store and retrieve a static popularity metric for products, enabling better decision-making for inventory management, marketing, and promotions.
Functionality
This plugin enables the following features:
- Storing a static popularity metric (
popularityInternal) in the database. - Exposing the popularity metric via the Shop GraphQL API.
- Integrating with ElasticSearch to enable sorting search results by product popularity.
Use Cases
The Product Popularity Plugin is ideal for:
- Displaying a predefined popularity metric for products.
- Sorting search results based on product popularity.
- Supporting marketing campaigns for popular products.
Installation
Clone the repository or copy the
product-popularity-plugindirectory into your project.Navigate to the plugin directory:
cd packages/product-popularity-pluginInstall the dependencies:
yarnBuild the plugin:
yarn buildAdd the plugin to your Vendure configuration:
import { ProductPopularityPlugin } from 'product-popularity-plugin' export const config = { plugins: [ ProductPopularityPlugin, // other plugins ], }
Usage
Start the Vendure server:
yarn startAccess the admin UI at
http://localhost:3050/adminand log in with the default credentials (superadmin/superadmin).Use the shop GraphQL API at
http://localhost:3050/shop-apito query product popularity data.
Testing
Run the end-to-end tests:
yarn testModify the tests in
test/e2e.spec.tsto suit your plugin's functionality.
Publishing to NPM
Ensure you are logged in to NPM.
Build the plugin:
yarn buildPublish the plugin:
yarn publish
Resources
- Vendure Plugin Documentation
- GraphQL Code Generator for generating TypeScript types for custom GraphQL types.
