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

Commerce Shipping brings a lot to the table

This week we finally packaged the full release of Commerce Shipping 2.0, and I couldn't be happier. Thanks to the efforts of my co-maintainer, googletorp, and contributors helior, cvangysel, and andyg5000, we have a solid shipping framework for Drupal Commerce that offers more flexibility and granular control than any other shipping system I've seen, Drupal or not.


Commerce Shipping checkout panes on the default checkout form.

What's the big deal?

As I wrote in the release notes, this milestone really is a big deal for Drupal Commerce. Among the many benefits this module brings to the table are:

  • The ability to use any number of shipping methods to calculate shipping rates on a site, using Rules to control when a particular method should be enabled. You can use one carrier to quote domestic rates, another to quote international rates, and a flat rate to offer free shipping if certain conditions are met.
  • An architecture that subdivides shipping methods into their individual shipping services (e.g. Ground, 2nd Day Air, Next Day Air, etc.), giving you granular control through Rules over which services should be available to an order. You might use this to ensure perishable products only ship overnight or to only offer guaranteed delivery dates for items in stock.
  • A shipping rate caching system that allows carrier rated quotes to be fetched in a single API request and stored locally (with an optional timeout) for the duration of the checkout process.
  • A shipping rate calculation API that lets you perform additional calculations on top of the base shipping rate for each service through custom modules or Rules. This allows you to add taxes, handling fees, discounts, and more to your shipping rates. It also turns the Flat Rate module into the basis for more complex shipping calculation schemes - weight based, quantity based, etc.
  • A checkout pane that can automatically recalculate shipping rates as customers enter their billing and shipping information. This lets you display accurate shipping rates that depend on address data on a single page checkout form.

Additionally, in conjunction with last month's Commerce 1.4 release, Drupal Commerce supports copying addresses and other matching field data between your billing information and shipping information checkout panes. Many thanks to the contributors mentioned above for working out all the kinks between this feature and the recalculation of shipping services.

This architecture removes limitations found in other open source eCommerce systems, like Ubercart and Magento, that often take an "all or nothing" approach to showing shipping services from any given carrier on the checkout form. Even better, features that this module delivers for free would actually cost you extra to add to systems like Magento that nickel and dime you through plugin marketplaces just to make your checkout form more customer friendly. Tongue

Next steps for Commerce Shipping

With this release there are already modules to support Flat Rate shipping, carrier rated quotes from UPS, FedEx, USPS, and others, and in store pickup facilitated by Kiala. Additional contributed modules focus on extending the system with other features, like joachim's Shipping Weight Tariff module that offers a simplified table based interface for setting shipping costs by total order weight.

Next steps involve bringing these contributed modules and their dependencies (like the Physical Fields module and Commerce Physical Products) to a full release, an effort already underway thanks to andyg5000 and other contributors / maintainers.

This work has been a community effort, and it has paid off for everyone. Smile

Book Review: Drupal E-commerce with Ubercart 2.x

Developing Ubercart was a wonderful experience. I learned a lot about software development, Drupal, web technologies, and worldwide communities. At the end of my time leading the project, I could also see that thousands of people were using the software to sell products for profit, bring people together at events, and raise money for many worthy causes and organizations. Seeing now a book written to help even more people do these things is an added treat.

I was asked to review Drupal E-commerce with Ubercart 2.x published by Packt and received an e-book and three physical copies to give away at DrupalCon San Francisco. I started reading the e-book on that trip and finally finished on the plane home from DrupalCamp Colorado.

What follows is my review with a chapter by chapter analysis of the content. What I saw was very encouraging, and I applaud the authors, George Papadongonas and Yiannis Doxaras, for their effort in delivering this work to the community. My review picks up on what's great about the book, what could use some work, and who I think would benefit most from owning it.

Before the in-depth analysis, here's a quick summary:

  • This book provides a very comprehensive look at Ubercart's major core and contributed features, modules, and themes (free and commercial). It's the most expansive summary of all that Ubercart offers I've seen. The value in this exposure can't be overstated, and it's for this aspect of the book alone that I'd recommend it to anyone diving into building e-commerce sites with Ubercart.
  • The book includes chapters and content introducing the user to Drupal itself. I suppose this was to make it a standalone resource for building e-commerce sites on Drupal, but I think the book would have benefited from a sharper focus on Ubercart itself. Referencing one of the many general Drupal books, even titles published by Packt itself, would have been sufficient for topics such as installation, search engine optimization, and theming.
  • The book introduces all of Ubercart's features but doesn't often address the reasons for a particular feature's existence or the best practices for implementing it. For example, chapter four could have provided a lengthier introduction to product attributes so readers have a fuller understanding of the reasoning behind the system, when and how to use them, and what to look out for (like losing adjusted SKUs when attributes are modified on a product). If the book were made shorter by removing the general Drupal instruction, the content could easily be made up in those sorts of discussions.
  • In other areas, the discussion is particularly well thought out and helpful. I thought the payment discussion was great.

Read on for the chapter by chapter summary and review. As I said in the first point, I'd recommend this book to any newcomer to Ubercart. Experienced users might not find much new here but could still employ the book as a desk reference. Anyone looking to write modules and customizations for Ubercart won't find much here - but that wasn't really the point of the book.

For more information, resources, and errata, you should refer to the book's own website, http://www.drupalubercartbook.com/.

Chapter One: Getting Started

The first chapter provides a quick introduction to both Drupal and Ubercart that hits all the high points of using the software to build your store. It then takes the approach of showing the end product first - there are screenshots and a feature walkthrough demonstrating the store that the reader will build by the end of the book. Good idea!

Chapter Two: Installation of Drupal and Ubercart

The second chapter covers installation of both Drupal and Ubercart and should successfully guide a newcomer with some technical experience through the installation process. If anything, it might be a little too thorough. Because the book isn't really a Drupal primer, many of the details and "gotchas" for general Drupal installation could have been left out entirely. Furthermore, instructing readers to download Ubercart from Ubercart.org instead of http://drupal.org/project/ubercart seems risky, as the Ubercart downloads page has a history of lagging behind releases.

I was impressed that the book included a section on the UberDrupal installation profile, and in the first update of the text it would be good to mention that drupal.org now automatically packages distributions based on installation profiles that include all the necessary modules. To install Drupal and Ubercart now, one would simply have to grab the latest distribution from http://drupal.org/project/uberdrupal ... but now I'll need to go make sure all the modules in that package are up to date!

Chapter Three: Basic Configuration

The third chapter runs through various administration pages and configuration forms describing what a lot of the forms and settings do. As with the previous chapter, I would've left the general Drupal information out, but the chapter doesn't suffer from having it in there. The main problem with the approach as I see it is the chapter introduces all the various Ubercart settings, but at this stage in the book they're divorced from any greater context. Descriptions of some of the settings aren't helpful without greater knowledge of how Ubercart works in general, so the discussion would have fit better in a chapter specifically introducing the topic (e.g. introducing order panes, invoices, and settings in a chapter on Ubercart orders).

Chapter Four: Managing Categories, Products, and Attributes

Chapter four is spot on when it begins by emphasizing planning. Ubercart offers multiple ways to simplify product catalog creation and administration, and the authors provide a good overview of how to get it done. I was pleased to see a description of product classes, but it would have been greatly improved by a discussion of how to take advantage of their default attribute settings. Those sorts of tips should save store administrators plenty of time.

I did feel like the introduction of Tagadelic was a little distracting and might recommend placing all the contributed module discussions in the later chapters on customizing / optimizing the store. I also think it would be helpful for the order of the information to be adjusted, so that readers are instructed on how to make attributes and product classes before bothering with information on product kits and especially product importing (as that will often require classes and such to be configured in advance). In fact, given the poor support for product importing in general, I'd almost want to just punt that whole section off into an Appendix or at least a separate chapter where the pitfalls and strategies for the topic can be addressed.

Chapter Five: Managing Shipping and Packaging

Chapter five introduces the configuration of shipping quotes and Ubercart's limited product packaging functionality. It includes a brief description of the Conditional Actions system, but in my experience with training, there is not near enough material here. You could really include an entire chapter on navigating the CA interface, explaining the concepts, and walking through screenshots of setting up predicates. Most people won't understand how to add conditions and actions, especially when it comes to grouping, logical operators, and argument selection. While I wouldn't expect an introductory book to be a full manual on the system, the instructions and few screenshots scattered through the chapters seem insufficient for getting started.

Chapter Six: Managing Taxes and Payments

Chapter six covers taxes and payment, two essential parts of any online store. Figuring out taxes is one of the trickiest things for any online store, especially stores selling physical goods across multiple tax jurisdictions. The chapter provides a sound overview of Ubercart's tax features, but this is one of the rare places in the book where appropriate contributed modules aren't mentioned. Users should be aware of tax modules providing out of the box support for specific tax jurisdictions (like some countries / states) and VAT.

The payment discussion shines in this chapter as one of the most thorough and helpful of the entire book. It includes a lot of the background information and best practices instruction that I felt would've benefited other discussions in the book. Many readers, especially those new to e-commerce in general, will find the payment section extremely helpful.

Chapter Seven: Managing Customers and Orders

Chapter seven begins with a helpful introduction to the order management features of Ubercart, including a nice explanation and graphic explaining the difference between order states and statuses. The chapter is full of screenshots and instruction for administering orders and reminds me that in spite of Ubercart's limitations, there's still quite a lot you can do with it.

The chapter does mostly gloss over the packaging and shipping features on order screens, but those are seldom used features and the mention seems sufficient. Readers should get a firm grasp on how to create and administer orders from this thorough chapter. There are some minor errors in the chapter, like saying that Ubercart's reports depend on Views (they're actually stand alone and worse off for it), but nothing that should confuse newcomers to Ubercart. Also, the chapter helpfully introduces readers to CiviCRM but fails to mention how to setup an ongoing integration between it and Ubercart using the contributed integration modules.

Chapter Eight: Customizing the Frontend

Chapter eight is something of an enigma. It's full of useful information, but it feels more like a brain dump of the many ways to theme a Drupal site (from free and commercial themes to rolling your own using Zen or from scratch) than actually customizing a frontend for an Ubercart store. I'd expect to find information on theming product pages, the shopping cart, the checkout form, and order invoice templates. Instead, the chapter offers many different ways to prepare a custom Drupal theme without really going deep into any particular topic. This is one of those more general Drupal introductions where recommending a reference book on Drupal theming at the beginning and then explaining how to specifically customize the Ubercart frontend would've been more helpful.

Chapter Nine: User Interface Enhancements and Techniques

Chapter nine takes a look at using contributed modules to improve the user experience of your store for the purpose of increasing sells. I didn't find the cross-selling section useful beyond finding out that the Recommender module has an Ubercart integration module. It never went beyond introducing a couple methods without really applying them, and I didn't see mention of the UC Upsell module which was written specifically for thus purpose. However, the chapter moves from there to a much more useful section introducing using Panels, Views, and the Ubercart Views module to merchandise products.

The rest of the chapter introduces some key contributed modules that enhance the shopping cart / checkout form and others for offering discounts and coupons to your customers. The AJAX cart block module mentioned is a great way to get around the limitations of Ubercart's static cart block when page caching is enabled. The UC Discount Framework module doesn't get mentioned (likely due to its development status), but it provides an additional way to provide discounts using the Conditional Actions system. You might never use all the modules mentioned in this chapter (though you're bound to use some), but simply knowing they exist will help you greatly as you build out different types of sites.

Chapter Ten: Optimizing and Promoting Your Store

Chapter ten walks through various optimization topics regarding search engine optimization, marketing your site, improving performance, and enhancing security. It starts by walking through configuration of various modules recommended by the SEO Checklist module. Following the chapter on cross-selling products, I expected Packt to mention the Drupal SEO Book here.

There are certainly more ways to market your site and improve performance than are mentioned, but the chapter should provide a good start for new store owners to get a leg up. In what seems to be an oversight, the Ubercart Google Analytics module isn't mentioned in the discussion on Google Analytics, but enabling that module will cause actual sales data to be reported to Google Analytics for review in addition to goal completion.

Appendices

The appendices offer some nice extra information, like how to take advantage of the UC Hotel module to sell hotel reservations using Ubercart in Appendix A. It won't be useful for many people, but for those who need it I'm sure it will be helpful. That's why it's an appendix I guess! The remaining appendices list all the modules referenced in the book (there's a lot!) and a host of free and commercial Drupal themes that are ready for e-commerce use and/or specifically designed with Ubercart in mind.

Ready to fly: DrupalCon SF

DrupalCon San Francisco will mark my first time traveling with a rolling carry-on instead of the duffel I've brought to every conference / camp since Barcelona. It's a good thing, because Packt was kind enough to send along several copies of their new Ubercart book for me to give away in the Commerce Guys Ubercart Training. I look forward to shedding those pounds on Sunday and replacing them with some sweet new Drupal shirts throughout the week.

Assuming the rest of the team makes it through the volcanic ash, I'm also looking forward to getting on stage in the Sponsor Theater (E. Mezzanine, 236-238) to talk about the latest news with Commerce Guys. Our sponsorship affords us the opportunity to bring together the whole crew for the first time to talk about our vision for the future of e-commerce on Drupal and how we're working to make it a reality. Mark the time in your schedule - Tuesday, 9:45 - 10:45 AM - or stop by the Commerce Guys booth to get the skinny in person / express your interest in relocating to Jackson, MI...

I'll be unveiling the Drupal Commerce demo site during our sponsor spotlight and will discuss it in further detail in my session, From Ubercart to Drupal Commerce. The session will be on Wednesday, 9:45 - 10:45 AM in room 306 Trellon. We had a great crowd in Portland show up to see / hear the latest last week, and I look forward to delivering a slightly more organized presentation in San Francisco.

I'm looking forward to a lot of great sessions, too, and I can't wait to meet up with some old Drupal friends and new contributors to Drupal Commerce. If you're eager to meet up, leave me a note in the comments or use my contact form. I'm happy to hook up for dinner or find you around the venue, and you can always stop by the Commerce Guys table to get in touch.

E-commerce will be huge on Drupal 7, and DrupalCon will be the kick-off. We'll be following up with Drupal Commerce presentations at the CMS Expo in early May, Web Content 2010 in early June, and hopefully a Drupal Camp or two in June / July. But first... I have to survive this next week.

Pages