Drupal Commerce Blog

What's happening in the world of Drupal Commerce.

Commerce 2.0 alpha3 released

It's time show you what's kept us busy in February. Say hello to alpha3! Aside from the many bug fixes, the focus is on improving cart functionality. We've also been busy stabilizing Inline Entity Form with dozens of commits and two new releases.

Reminder: Commerce 2.x alphas are NOT production ready. No upgrade path is provided between alphas. A full reinstall is needed each time.

Shopping Cart Block

The 1.x cart block was just a small embedded View. We researched over 20 eCommerce sites, and found that they all use a design similar to Commerce Kickstart v2, a cart icon showing the number of items in the cart. Optionally, clicking the cart icon shows a summary of the items inside.

So, that's what we did for 2.x:

The summary shown on click is optional and can be disabled. It's powered by a View, making it easy to customize.

Updated Shopping Cart View

The cart view now shows the product rendered in the "Cart" view mode as the first column. Using rendered entities instead of individual Views fields stitched together is a best practice since Drupal 7, and we're reflecting that in our new defaults. This allows users to easily control field visibility (hide / show attributes, link to product) and themers to easily override the markup (e.g. to place the image in a different column).

New Add to Cart Form

The first two alphas shipped with a simple add to cart form, with a dropdown selector for the variation. Alpha3 ships with a completely rewritten add to cart form, supporting attributes and exposing line item fields.

The 1.x add to cart form code was large, difficult to maintain and customize. We spent many iterations ensuring the new 2.x code is easy to understand and fully covered by tests. The new form is actually a line item creation form shown in a special form mode. The attribute selection logic lives in a widget for the line item's purchased_entity field. Exposing the quantity or a custom line item field is as easy as editing the form display:

Inline Entity Form (IEF)

IEF plays a central role in the Drupal Commerce user experience, since it powers both the product and order add / edit forms. It is a dependency Commerce shares with Media, with Janez Urevc (slashrsm) being both the Media lead and IEF co-maintainer. At the end of January, IEF was in poor state, with many critical bugs and lacking test coverage. In February a team consisting of Janez, Ted Bowman (sponsored by Acquia), and myself spent over month of developer time on stabilizing the codebase.

Our results:

  • 40 commits, fixing over a dozen critical bugs, introducing complete test coverage
  • 41 files changed, 1928 insertions(+), 1101 deletions(-)
  • 2 alpha releases (alpha4 and alpha5)
  • Beta1 on the way

With stability now approaching Drupal 7 levels, we can now focus on adding features important to Commerce, such as support for translating inline entities (such as product variation).

General Updates / Improvements

  • Product variation titles are now stored in the database instead of being generated on the fly, resolving issues with the autocomplete on the line item creation form.
  • Product variation title generation can also be turned off per-bundle, allowing variation titles to be manually entered.
  • Store / product / order Views now have bulk delete functionality.
  • Multiple currencies can now be imported at once.
  • Initial rewrite of the tax type UI.
  • Fixed errors preventing reinstall.

Special thanks to Rob Harings (harings_rob), who contributed many fixes for this alpha.

Next Steps

With work branching into many different directions, we had to remove checkout from the plans for this release. That's our biggest priority going forward. We'll also continue to polish the product, order, tax UIs.

As always, we're on IRC at #drupal-commerce, with meetings every Wednesday at 3PM GMT + 2 and at 4 PM GMT - 5.

Bojan Zivanovic
Posted: Mar 2, 2016

Comments

tim@ellemeet.net tim on March 19, 2016

Hi, great progress so far. Commerce + Drupal 8 + symfony is really exciting. What is the current roadmap for all those commerce guys contrib modules like kameleoon and nosto?

Keep up the good work!

Sky Buzz on April 9, 2016

I cannot see any checkout button on the cart page...!
Add to cart form is not configurable properly. It is showing administrator field for users also. Example editable price field and multiselect product properties, etc.

silvertipp on April 28, 2016

Hey guys, great work on everything so far! Is there any estimated timeline for the beta and commerce checkout? I know you guys originally thought sometime late March or early April, so I was just wondering if you had a new expectation?