
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
@pinelab/pinelab-frequently-bought-together-plugin
Advanced tools
Increase average order value by suggesting frequently bought together products based on past orders. Also known as related products or product recommendations.
This plugin finds products that are often bought together by looking at past orders. You can integrate these frequently bought together products on your storefront, and so increase your revenue.
import { FrequentlyBoughtTogetherPlugin } from '@vendure-hub/pinelab-frequently-bought-together-plugin';
const vendureConfig = {
plugins: [
FrequentlyBoughtTogetherPlugin.init({
// Disable this in production!
experimentMode: true,
// Test this support level first. See below for more details.
supportLevel: 0.001,
}),
AdminUiPlugin.init({
port: 3002,
route: 'admin',
app: compileUiExtensions({
outputPath: path.join(__dirname, '__admin-ui'),
extensions: [FrequentlyBoughtTogetherPlugin.ui],
}),
}),
],
};
You can get the related product via the shop API with the following query:
{
product(id: 2) {
id
name
slug
frequentlyBoughtWith {
id
name
slug
}
}
}
Product relations in the Shop API are sorted by support, meaning that the most bought together products will appear first in the list. The admin UI shows relations in random order due to the unordered nature of SQL relations.
Each shop's optimal support level varies based on data density. For example, a shop with many variants and few orders requires a lower support level. To experiment with support levels:
experimentMode: true
in the plugin's init function.http://localhost:3000/admin-api
or use a GraphQL client like Yaak to use the admin API{
previewFrequentlyBoughtTogether(support: 0.1) {
# The peak amount of memory that was used during calculation. This should be a max of 80% of your worker instance
maxMemoryUsedInMB
# The different products that are included in the relations
uniqueProducts
# Total number of item sets
totalItemSets
# Most confident item sets
bestItemSets {
# E.g. ['product-1', 'product-5']
items
# Support is the number of orders this combination was in
support
}
# Least confident item sets
worstItemSets {
items
support
}
}
}
When you have found your desired support level, you set it in the plugin:
FrequentlyBoughtTogetherPlugin.init({
// Disable experiment mode in production!
experimentMode: false,
supportLevel: 0.00005
}),
/admin/catalog/products
Calculate frequently bought together relations
The frequently bought together relations are now set on your products.
Tips for Tweaking Support Levels:
0.1
) and gradually reduce (0.01
, 0.001
, etc.).To set different support levels for channels:
FrequentlyBoughtTogetherPlugin.init({
// Disable experiment mode in production!
experimentMode: false,
supportLevel: (ctx) => {
if (ctx.channel.token === 'channel-with-lots-of-variants') {
return 0.000001
} else {
return 0.0001
}
}
}),
Use the vendure-token
header to preview queries for specific channels.
FAQs
Increase average order value by suggesting frequently bought together products based on past orders. Also known as related products or product recommendations.
We found that @pinelab/pinelab-frequently-bought-together-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.