The Drupal Commerce product bundle debacle

The Drupal Commerce product bundle debacle

So, I want an Ubercart Product Kit. A simple grouping of products that can be purchased together and offered at a slight discount. Can Drupal Commerce do it? We'll sort of. 

Thomas Editson tried over 2000 fillamant types before finding the proper a long lasting type that is now in todays lightbulbs, he didn't see that as 2000 failures but just 2000 that didn't work. That's how I feel trying to get a Product Kit functionality in Drupal Commerce.

What doesn't work

Obviously my first stop was Commerce Product Bundle, it's an alpha module last updated in 2012. Not great, but it reportedly has 829 users. Installing was straight forward, create a "Bundle" product type with multiple Product reference fields, set their view mode to Bundled Product: Add to Cart, create a Product Display and off I go. Upon creating and viewing my Bundles product... Errors galore. 

Then I updated to the Dev version, the original errors went away, but upon adding to cart... BOOM, more errors.

I should add that my products are Files, so I'm using commerce file and commerce license, so after scowering the issue queue I discovered you need Commerce File Bundle! But accotding to the issue queue, it doesn't work with Commerce File 2.x, so I'm not even gonna try. Most people are saying that Commerce Product Bundle is dead anyway, so down the rabbit hole I go.

In the queues, people are offering all kinds of solutions for ways to add multiple items to a cart at once.

Next Stop: Commerce Bundle

It's a bit scary... Dev... 174 reported users. It's supported by Commerce Guys. There's documentation and a video. Should I be 175? Gasp! The first issue queue topic it "Cannot add Bundle to Cart", this sounds wonderful.

Commerce Bundle is a bit complicated to wrap your head around. It introduces new entities like Bundle Groups and Bundle Items. Basically you set up a Bundle Group like a Product Display so you can have all of your Variations to choose from, each product variation you add becomes a Bundle Item. Then you create a Product Display with a Product Reference to multiple Bundle Groups. When you view the Product Display, you can Add all the Bundle Groups to the cart at once. 

Huh?

  • Product Display: Displays Bundle Groups which are basically nested Product Displays
  • Bundle Groups: Where you setup all your product variations, it gets a unique SKU and you can set a different "group" price. The name Bundle Group is kind of misleading because it's not a group of products that can be bought together, it's really a Secondary Product Display (or Nestable Product Display) which can be purchased with another Secondary Product Display.
  • Bundle Item: These are just containers for the individual product variations included in the Bundle Group. They entity reference to a product and can have a seperate price. (Yes, entity reference can be a verb)
  • Product: Your basic commerce product with sku and price

So, the setup is fairly complicated and cumbersome, especially if you don't have multiple variations per product, meaning if you only have 1 SKU per product, you have to create a Product, Bundle Item, Bundle Group for each product, then Product Reference all your Bundle Groups together under a Product Display Node. After setting this up with a handfull of products, I was able to add multiple items to the cart. Yea!

Going back to my use case, I wanted to set a discount on the bundle, and after all of this, it's not exactly possible. The only way to get a discount is to change the price per "Bundle Group". So you can't say $50 off this Product Display, you have to go into each product referenced Bundle Group and set a seperate discounted price, having the total of all of them total equal the $50 discount. Boo!

With this much complication, how am I supposed to hand this off to a client and say "It's ready to go, have at it"? Double Boo!

And the Triple Boo is, I'm using commerce file and commerce license to sell file downloads, with this method the file licenses don't get setup correctly upon order completion. Hopefully with rules I can make some magic happen.

No solution?

Without going totally custom, I don't see an easy way to make "Product Kits" work in Commerce. Dare I say that Commerce may not be the right tool for the job? Ubercart for Drupal 7 has all of this built in. I can hear the Ubercart community laughing at me right now. Most people will tell you that Ubercart is dying off, however I have an old hammer that hits just as good as my new hammer, so why not use it if my new hammer can't do the job?

My "Custom" Solution

So, before I trash my Commerce install and all my work thus far, l have final attempt that is a little creative. If I can get multiple items added to the cart in one click, then I can use Commerce Discount to calculate the discount based on the products that were added to the cart. My first attempt utilized PADO! PADO lets you set your product variations as checkboxes, so the user can select which other products they would like to add in addition to the current product, kind of like upselling. For me, I don't want the customers to have to checkbox anything. Next...

For my use-case, the winner is Commerce Add to Cart Extras. This allows you to display a view of all the product variations with a single add to cart button - these variations have become my bundle of products. They describe it as a way to allow customers to select a quantity of each variation, but the trick is to set the quantity default to 1 and then Exclude it from the view. Bingo! Now I can add multiple items to the cart. I added a generic Total Bundle Price field to the Product Display which I customized the a View template file to display after the table of product variations. This part is kind of a hack because you have to manually calculate that price based on what the real discount will be, but it works for now.

Drupal 8

With Drupal 8 on the horizon, it's a little scary that we don't have a solid solution for this yet in Drupal 7. Commerce in Drupal 8 has been re-architected, so most likely all of the above mentioned "solutions" will change and need rewritten. So it doesn't feel like we are working on solid ground yet with Commerce. On the other hand, the Ubercart guys are working on a Drupal 8 version which will undoubtedly continue to have product kit functionality built-in. As much as I wanted to believe that I was future proofing myself by using Commerce, I probably would have been better off using Ubercart because it doesn't seem to be going anywhere for the time being. 

 


Written by Bob Kruse

Bob Kruse's picture
I am the Executive Producer at 2440 Media, a web design and development firm in Pittsburgh, PA. I've been building websites for over 20 years. I don't feel that old though.Follow me on:Google +
Twitter