npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pinelab/pinelab-frequently-bought-together-plugin

v1.3.0

Published

Increase average order value by suggesting frequently bought together products based on past orders. Also known as related products or product recommendations.

Downloads

338

Readme

Frequently Bought Together Plugin

Official documentation here

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.

Installation

  1. To install the plugin, add it to your Vendure config and include its Admin UI extension in the Admin UI plugin:
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],
      }),
    }),
  ],
};
  1. Run a database migration to add the custom fields to your database.

Storefront usage

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.

Experiment mode

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:

  1. Start the server locally, and make sure you have set experimentMode: true in the plugin's init function.
  2. Go to http://localhost:3000/admin-api or use a GraphQL client like Yaak to use the admin API
  3. Execute the following query against 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
      }),
  1. Run the server again
  2. Go to /admin/catalog/products
  3. Click the three buttons at the top right and click Calculate frequently bought together relations

The frequently bought together relations are now set on your products.

Tips for Tweaking Support Levels:

  • Start high (e.g., 0.1) and gradually reduce (0.01, 0.001, etc.).
  • Review the worst item sets:
    • Increase the support level if they seem irrelevant.
    • If support equals 1, it indicates a single order—a poor indicator of frequent purchases.
  • Monitor memory usage to avoid exceeding worker RAM.

Channel specific support

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.