Why not combine shopping carts on user login?

When I first wrote Ubercart's Cart module, we knew we were going to support both anonymous and authenticated shopping carts and checkout. The decision came at a time when there wasn't consensus around the impact of forced login on conversions, but we knew we wanted it to be optional if at all possible. Additionally, for authenticated users, we wanted to preserve items in their shopping carts so they would see the same items when logging in from multiple devices or across multiple sessions.

This resulted in a small conflict that we had to figure out how to deal with: users could have items in their authenticated shopping carts but browse the site anonymously, create a new shopping cart, and then log in. What should happen to the items in their authenticated carts vs. the items in their anonymous carts?

There are three basic resolutions: combine the shopping carts together so the user still has a single shopping cart, remove the items from the previous session and leave it up to the customer to find them again if desired, or retain the old shopping cart but ignore it until the customer has completed checkout for the current cart. In Ubercart, I chose to combine the items, but in Drupal Commerce I changed course to retain the old cart but, from the customer's point of view, treat that anonymously created cart as the current cart after login.

We got some push back for this decision, but ultimately I didn't change the default functionality of Drupal Commerce. We just made sure there was an appropriate hook (hook_commerce_cart_order_convert()) so developers could alter this behavior on a site-by-site basis as need be.

From the merchant's standpoint, the thinking behind combining carts goes that you don't want customers to forget they intended to purchase those products in the past. However, from the customer's standpoint, suddenly having additional items in the cart after logging in during the checkout process is quite jarring.

In fact, I've been bitten by this behavior when shopping online at Barnes & Noble. Weeks prior to placing an order, I had put a Wheel of Time novel in my shopping cart but eventually bought the book in store. When I came back to the site to purchase a gift for my wife, I used a login button on the checkout form to quickly reuse my previous addresses and payment details. Unbeknownst to me, the website combined my old shopping cart with my current one such that my "quick checkout" experience made me accidentally order a book I already owned! I then had to spend 30 minutes with customer service canceling the order and placing it afresh just for the book I actually wanted.

That experience confirmed in my mind we made the correct decision not to combine carts automatically. As eCommerce framework developers, we have no clue where a developer might like to integrate login during the checkout process. Best to let them decide if it's safe to do something with those previous cart items instead of silently making the decision for them.

That said, I believe we can improve the experience even further. Right now, Drupal Commerce retains the old shopping cart order, and after the customer completes checkout they'll see the previous shopping cart as their current cart. This can be confusing as well!

My ideal situation would likely be a user interface component on the shopping cart page where customers can see items they had added to their carts in previous sessions, giving them the option to add those products to their current carts. If they decide not to, I don't see any harm in then just deleting those historical carts and moving on.

There's always room for improvement. Smile

Photo credit: alphageek


I like this. I would agree that a multiple basket type approach would be good. By having a basket for the authenticated session. Then if the user is browsing anonymously it would become a second basket when logged in. Unless, there was no other basket. I would say this is kind of a combined approach to the legacy way ubercart handled things and almost a wishlist like thing.

I would imagine if you were able to create "baskets" or collections of cart items a user could really get a lot of flexibility to possible create a basket then make a new basket so that he or she may be able to checkout a certain basket now. Then maybe he or she is waiting for some money so they can buy the next basket of items. It is like walking through the checkout line and putting some items on hold till you come through again or allow for things like layaway. Something like this would be really good for the ever growing online food shopping market.

I guess an easier way to do the basket thing would just have a cart archive. Anonymous user would just then be notified that there previous authenticated cart was archived. Then you could just have the feature of combining archived items with current cart.

I'd love to see a case study on user expectations. The whole "combine the cart" functionality, in my mind, just seems to be a developer's paradox of "where did the data go." Often times developer's like to find issues and fix them, without wondering about customer experience (is it an actual issue / is there an enhancement to be found.)

If done right, this could be a really slick feature unique to Drupal Commerce. It's almost like a remarketing tool - like a "other items purchased like these." There should probably be an option to display it as a block or page. That way I can pick to display it on the cart page, or maybe a process between the cart and checkout. This also can account for "when is the user forced to login? if at all."

As you said about your personal experience Ryan, the reason to login at Barnes & Noble had nothing to do with your basket, it was just to reuse previous addresses and payment info. We are used to the "add to basket experience", we spend time reviewing and selecting goods, but once we have selected the items we want we kill for the shortest path to end the purchase process. Ask amazon about buy-on-one-click results.

So my point is: leave the user alone, give her the shortest path. And as Matt said, let's think on how to use that useful information about old baskets to enchance her next experience on our platform (ie: remarketing) and everyone will win. My two cents Wink

wouldn't an even more complicated solution be to prompt the customer with either "You already have/had a these items in a cart from another session" or to really twist their mind show a graphic for a second cart. In either case giving options with what to do with the multiple carts (deletion options, combination options, and/or options).

Hah, I didn't even think about the use case where someone adds the same product to their cart. In Ubercart, it would just increment the quantity, which would be even trickier to detect as a customer. Tongue