Skip to main content
← Back to plugins
Product Primary Collection

Product Primary Collection

Set a primary collection for your products, so you can create the correct breadcrumbs in your storefront

Version2.3.0
Compatibility>=2.2.0
CategoryOther
Downloads578 monthly
Last updatedFeb 5, 2026

Official documentation here

To construct breadcrumbs and URL's it's useful to have a primary collection for each product, in case a product is part of multiple collections. This plugin extends Vendure's Product graphql type, adding a primaryCollection field that points to the primary collection of a product.

Primary collections can be selected in the Admin UI's product detail view.

This Plugin also exports PrimaryCollectionHelperService which can be used to assign primaryCollection's to products without existing values by running PrimaryCollectionHelperService.setPrimaryCollectionForAllProducts.

Getting started

Add the plugin to your vendure-config.ts:

Ts

And your good to go with just that.

Migrating from 1.6.0 to 2.0.0

  1. Always create a backup of your database
  2. Install the plugin and generate a migration
  3. In your migration file, add the function exportCurrentPrimaryCollections(queryRunner) to the top and savePrimaryCollection(queryRunner) to the bottom of the up function in your migration file, like so
Ts
  1. Run the migration.
Changelog
  • Upgraded to Vendure 3.5.3
  • Documentation update
  • Updated official documentation URL
  • Upgrade to Vendure to 3.3.2
  • Update Vendure to 3.1.1
  • Update compatibility range (#480)
  • Make primaryCollection custom field channel aware.
  • Resolve product.breadcrumbs when a product has a primary collection set
  • Updated Vendure to 2.2.6
  • Primary collection filter should hide Private collections (#395)
  • Fixed issue when creating a new product in Vendure (#367)
  • Updated vendure to 2.1.1
  • Config option customFieldUITabName added
  • Renamed admin ui extention NgModule from SharedExtensionModule to PrimaryCollectionSharedExtensionModule
  • the /src/ui folder will be copied into dist folder when running yarn build
  • Fix Error: Cannot find module '../types.ts'
  • Export the service class PrimaryCollectionHelperService which can be used to assign primaryCollections to products without existing value
  • Products will have a primaryCollection as a custom field which can be selected via Admin UI.
  • Added index barrel file to export plugin (#261)
  • Initial setup(#258)