Product Primary Collection
Set a primary collection for your products, so you can create the correct breadcrumbs in your storefront
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:
And your good to go with just that.
Migrating from 1.6.0 to 2.0.0
- Always create a backup of your database
- Install the plugin and generate a migration
- In your migration file, add the function
exportCurrentPrimaryCollections(queryRunner)to the top andsavePrimaryCollection(queryRunner)to the bottom of theupfunction in your migration file, like so
- 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
primaryCollectioncustom field channel aware. - Resolve
product.breadcrumbswhen 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
customFieldUITabNameadded
- Renamed admin ui extention
NgModulefromSharedExtensionModuletoPrimaryCollectionSharedExtensionModule - the
/src/uifolder will be copied into dist folder when runningyarn build
- Fix
Error: Cannot find module '../types.ts'
- Export the service class
PrimaryCollectionHelperServicewhich can be used to assignprimaryCollections to products without existing value
- Products will have a
primaryCollectionas a custom field which can be selected via Admin UI.
- Added index barrel file to export plugin (#261)
- Initial setup(#258)
