Should developers embrace Drupal Commerce 2.0-rc1

Drupal commerce 2.0-rc1

Drupal Commerce 2.0-rc1 has finally got its full blown release, following eight months in the beta version. The phase in the beta version saw 58 contributors make 304 code commits, culminating in an extensive code rewrite with a redesigned UI, and several intuitive new features.

Apart from several handy tweaks aimed at a better user experience, such as the ability to reuse addresses at checkout, the new version offers some significant new improvements.

A Workaround for Composer

Today’s highly competitive environment gives little leeway for convoluted processes, and developers are constantly looking for workarounds, to make things simple. The composer often got into the way of developers seeking to finish projects quickly, with minimal fuss.

E-commerce websites and the associated payment gateways running on Drupal depend on several external PHP libraries, which have to be downloaded separately owing to licensing issues. Hitherto, the only way to download such PHP libraries has been through Composer.

Composer, despite having undergone speed and memory usage improvements over the years, still suffers from some limitations, such as a steep learning curve on how to use the command line, and often CDN being blocked in many countries, such as China. Moreover, Composer does not score high in user-friendliness. Running Composer with incorrect parameters, or in the wrong directory, runs the risk of cryptic failures.

Ludwig, a new offering, now gives developers not wanting to go through Composer’s learning curve, an option. It allows developers to simply download libraries to a folder inside the module and add them to the class autoloader, manually.

Read: What Drupal users must learn from the Panama Papers case?

Powerful Customizations through Twig

Today’s highly demanding customers seek higher value, and highly customized offerings.

Drupal Commerce 2.0-rc1 allows for seamless integration of Twig, the modern, hyper-fast, flexible, robust, and secure template engine for PHP. Twig facilitates easy customization of Drupal’s built-in order receipt emails, in a similar way to customizing any other website page. Drupal Commerce 1.x had a serious limitation of not supporting conditionals and not having access to the right token. Such limitations are now removed with the help of Twig.

Twig also powers order activity stream in Drupal Commerce. Each type of activity co-opts an inline Twig template, filled with the saved log entry data. Developers can support merchants better, by leveraging this handy functionality, to manage the presentation of the types of logged activities.

More Dynamic Promotions and Coupons

A noteworthy addition to the full blown version Drupal Commerce 2.0-rc1 is a revamped interface for merchants to manage out-of-the-box discounts and coupons.

Today’s highly demanding e-commerce world requires wooing customers with customized offers and promotions. Drupal Commerce now offers robust back-end functionality, which empowers merchants with unbridled flexibility in tailoring promotions and offers.

The “promotions form” now comes with two columns. The basic column deals with primary configuration elements such as title, offer, conditions, and coupons. The sidebar column enables optional settings. In addition, a new usage API allows merchants to set usage-limits on promotions and individual coupon codes. Compatibility settings allow merchants to decide whether to allow customers to combine multiple offers on the same order. Another intuitive option, enabling merchants to set per-customer limits, is on the anvil.

The “offer type” plug-in has also undergone extensive rewrite. This plug-in now comes with the capability to target either the entire order or individual order items.

A brand new conditions API, in conjunction with the redesigned conditions UI, makes its easier to attach conditions related to an offer to any entity, such as shipping methods. Merchants may use this API to limit promotions by multiple filters, such as customer address, product quantity, order total, and other limits. 

Complementing another new functionality of creating coupons in the admin pages is a coupon redemption form, with a matching checkout pane. The coupon, which sits in the sidebar on the checkout form beneath the order summary form, may be configured to allow either a single coupon, or multiple coupons, per order. Leveraging twig enables theme-building and customizing the resultant user interfaces.

Improved Payments Functionality

Seamless and flexible payment options are integral to any e-commerce website. In fact, an outdated payments page can undo all the good work of wooing the customer, and induce them to make a purchase.

The payments options in Drupal Commerce 2.0-rc1 has received a significant upgrade, with vastly improved on-site and off-site payment gateway APIs.

The most apparent backend improvement is in speed. The system now integrates new payment gateways in a few hours, a big upgrade from the days it took earlier. A host of vastly improved in-built functionality, such as built-in support for tokens, and pre-built UIs for authorizing, voiding and refunding payments, improves developer productivity, accelerates the development pipeline, and makes the e-commerce site look more sleek at the same time.

A big plus for developers is the option to leverage over 30+ ready-made payment gateway modules, built up by the ever vibrant Drupal community! The range of ready-made gateways extends to popular options such as PayPal, Stripe, Braintree, and Square.

Apart from the above options, Drupal core offers a new “manual” payment gateway option, handy to implement payment options such as cash on delivery, check payment, card on delivery, and bank transfer. When the customer completes the checkout using such payment options, the system creates a pending payment, with the payment instructions shown clearly to the customer. Merchants get a UI at the admin level to mark such pending payments as complete, manually.

The payment gateway configuration form now offers the same conditions UI as the promotion form, making it possible to limit payment gateways to specific customer rules, orders above a specific total, and other validations.

All payment gateway modules are now patched to support the RC1 API changes. Drupal has been constantly reviewing the payment gateways to ensure utmost safety and confirmation with industry best practices.

Taxes Become Flexible

Significant improvements have been effected in Drupal Commerce’s tax module as well. The tax module is now virtually a mini value added tax cloud, with easy extensibility. These changes fit in perfectly with the need for the increasingly global footprint of e-commerce merchants.

The big change is a rewrite of the “commerce_tax” submodule, to deliver better performance and user experience. Merchants may enter prices with or without tax. The product prices may be displayed with or without taxes, regardless whether the price has been entered with or without tax. Merchants also have the option to specify the location of their store registration, and collect taxes in different geographical areas. For instance, provision is now available for a store based in the USA but also registered in the UK, to collect EU VAT on digital products.

The system calculates taxes based on the applied tax type plugins. Developers may populate the tax rates by contacting a remote service such as Avalara, or by storing the available tax rates locally. The “custom” tax type stores a set of tax rates, and the applicable territories for each rate. The territories may be classified as countries, states, or on the basis of postal codes.

Read: Creating a Holistic Marketing System with Marketo-Drupal integration

Drupal also offers ready-to-use plugins, with predefined rates for the European Union, Switzerland, and Canada, complete with the logic for resolving which rate to apply in different scenarios. For instance, the EU plugin is capable of differentiating between physical and digital products, considering the regulations mandate charging different VAT on digital products and in-store purchases. The logic engine also considers various real life business scenarios, such as Intra-Community Supply (B2B), selling to non-EU customers, and various applicable territory exceptions such as in Lake Lugano, Aaland islands, and Busingen. The plugin for Canada likewise is “smart” enough to apply different rates for different provinces, as applicable.

Overall, Drupal Commerce 2.0-rc1 offers a significant upgrade, with several new features and fixes, but it is still a work in progress. There are still porting issues to be sorted out, and new releases of some payment gateways and shipping are still under works. However, it is only a question of “when” and not “if” for all the kinks to be ironed out.  The beta version already has more than a dozen sites, high performing ones at that, going live, using the code. The full blow release is sure to increase the number of sites using this powerful new software, exponentially.

Drupal 8

Author : Nayab Naseer Date : 11 Oct 2017