Try our conversational search powered by Generative AI!

Determine bundles in cart..


Hello All,

I am new to Episerver and I am looking for a way to determine if I have a bundle(s) in the cart.

In our solution the customer can add multiple products/Lineitems to the cart. I am looking for at way to determine the bundles I have in the cart based on the lineitems.

If it makes sense to you? Could you please push me in the right direction?

I have been looking at this:


May 30, 2016 15:51


Bundle does not really make sense in cart, one it's in cart, it becomes individual SKUs - so it's just more convenient for customer to add multiple items to cart at once.

You might consider the Package instead.


May 30, 2016 19:25

Hi Quan Mai,

Thanks for your reply.

I've been looking around in our solution and get what you explained. Because we are using Bundle in our solution/case the user can add a Bundle to the cart but can also add the products in the bundle one at the time and still get the "bundle discount". That would not be the case using the Package - I think - right?

On our bundles, we have something called a MixMatch code. What I was hoping I could do was to add this code to each Line Item that make up the bundle. This is not a problem when the user adds the bundle to the cart at once. But if he surf around the site and add one product at a time it starts to get a little tricky to determine if  the collection of Line items represent a particular bundle and therefore must have our "MixMatch code". And a product can also exist in multiple bundles.

That sounds like a dead end. But I would appreciate any suggestions.


May 30, 2016 21:09

I might not fully understand your problem here - but what I see that you're referring to Package, which you can set the price on it own. So if your package has item A and B, you can still set it price to C, while C < A+B, as a "discount".

And of course you can have some promotion so if the cart contains certain items, customer will be awarded with a discount.


May 31, 2016 9:24

Hello Quan Mai,

Thank you.

I have had a look at Promotions that you refer to.

I am working in Episerver 8. Is it possible to grab the "Promotion Name" for each product? I would like to do it during checkout, so I later on can use that information.

I have looked here:

I think it is hard finding examples on the internet.


Jun 17, 2016 14:06

I'm not sure what you meant "Promotion Name for each product", but is it the name of the promtion which was applied to the line item in the purchase order?

OrderForm, Shipment and LineItem all have Discounts property, which are collections of Mediachase.Commerce.Orders.Discount. Discount has DiscountName which is usually set to the name of the promotion.


Jun 20, 2016 8:13

I would continue to use bundles and not packages.  If you want to see if an product or variation belongs to a bundle there is a an extension method in EPiServer.Business.Commere.Extensions


Then you can check the child entries to get the other products / skus that belong to it.

Jun 20, 2016 10:23

Hey Quan Mai and Mark Hall,

Thank you so much for your answers.

What I tried to do was(Sorry if not everything make sense - I am new to Episerver):

We often offer special offers where we get refund from the vendor. These speciel offers are most of the time put  together in a bundle. To provide the back office a better overview of these "refund-products" we would like to add a code / ID on these product but only if they act together in the basket.

My first solution was two make it posible for the web editor to add a code / ID to the bundles. That code / ID would again be added to the LineItem when the user added the Bundle to the  basket. The problem is that I can not add the code if the customer surf the website and add each product separately.

I also tried to use promotions and do something like this:

item [Constants.Metadata.LineItem.MixMatchCode] = GetDisplayName (itemRecord.PromotionItem.DataRow, Thread.CurrentThread.CurrentCulture.Name); But we do not allwayes add discount to every lineitems.

I went back to the first solution that we are going to release tomorrow. In one of the next releaes I will try out adding "EPiServer.Business.Commere.Extensions" to the project. And then use entryConent.GetParentBundles () and bundleContent.GetEntries (). But I also considering investigating  the possibilities to build something myself in Episerver.

Learning every day:)

Thank you!



Jun 22, 2016 9:45

If I could understand it correctly, Your sales team want to see the products that has been sold as bundle.

This can be achived via a schedule job also, without adding columns in line items. In schedule Job you will be loading the orders and doing processing for your sales team and generating a report for them, you will be using entryConent.GetParentBundles() to find the bundles.


Jun 22, 2016 11:35
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.