HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

  • The EPiServer.Commerce.Catalog.Linking.BundleEntry class represents _bundle_ entries.

  • The EPiServer.Commerce.Catalog.Linking.PackageEntry class represents _package_ entries.

  • The EPiServer.Commerce.Catalog.Linking.IRelationRepository service administers each.

For an introduction to these concepts, see [Bundles and packages](🔗).

The Child property of the BundleEntry or PackageEntry contains the ContentReference of the entry included in the bundle/package. The class also has a SortOrder property for ordering the entries, a GroupName property for grouping entries, and a Quantity property containing the quantity of the entry in the bundle/package.

EPiServer.Commerce.Catalog.Linking.EntryRelation contains the following default values: DefaultGroupName and DefaultQuantity.

A BundleEntry or PackageEntry is uniquely defined by the ContentReference in its Child property together with its Parent property (referencing the bundle or package itself). That is, you cannot add the same entry more than once to the same bundle or package.

## Get the entries of a bundle/package

To get bundle/package entries, call the GetChildren method of IRelationRepository with the ContentReference of a bundle/package.

Sample code

Or, you can get the bundle/package entry links from bundle/package content via bundle/package content extensions:

Sample code

## Get the bundle/package by an entry

To get the packages/bundles, call the GetParents method of IRelationRepository with the ContentReference of a catalog entry.

Sample code

Or, you can get the bundle/package links from a child item via entry content extensions:

Sample code

Adding an entry to a bundle/package

To add new BundleEntry or PackageEntry objects to a bundle or package, use the UpdateRelations method or UpdateRelation extension method of IRelationRepository. The new entry must have a Child ContentReference, a Parent ContentReference, and you probably want to specify a Quantity and Group.

Sample code

## Update an entry in a bundle/package

To update BundleEntry or PackageEntry objects, such as updating the Quantity, use the UpdateRelations method or the UpdateRelation extension method of IRelationRepository. You can construct a new object to replace the old one (matched by the Parent and Child properties). Or, use GetParents to get the existing Relations, filter out the object you want to update, and pass it to UpdateRelation after changing the value.

Sample code

## Remove an entry from a bundle/package

To remove an entry from a bundle/package, call the RemoveRelations method or RemoveRelation extension method of IRelationRepository with a BundleEntry or PackageEntry object matching an existing bundle/package entry. You can construct a matching object, or use GetParents to get the existing Relations, to filter out the object you want to remove and pass it to RemoveRelation.

Sample code