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.
Add the plugin to your vendure-config.ts:
And your good to go with just that.
1.6.0 to 2.0.0exportCurrentPrimaryCollections(queryRunner) to the top and savePrimaryCollection(queryRunner) to the bottom of the up function in your migration file, like soprimaryCollection custom field channel aware.product.breadcrumbs when a product has a primary collection setcustomFieldUITabName addedNgModule from SharedExtensionModule to PrimaryCollectionSharedExtensionModule/src/ui folder will be copied into dist folder when running yarn buildError: Cannot find module '../types.ts'PrimaryCollectionHelperService which can be used to assign primaryCollections to products without existing valueprimaryCollection as a custom field which can be selected via Admin UI.