New features are available for WooCommerce, now you have a great opportunity update your extensions and finally update WooCommerce. If you’re a developer looking for technical details, read the following article.
3.0 is a major update, which brings some great enhancements:
- CRUD (Create, Read, Update, Delete) classes
- Major improvements to product gallery
- A new CLI powered by the REST API
Let’s lean about these important additions and explore the Bionic Butterfly in more detail.
CRUD (Create, Read, Update, Delete) classes
Version 3.0 introduces CRUD classes with this release which can help developers to modify orders, customers, products, line items and shipping zones with less code.
The benefits of this addition:
- The structured data is defined for each resource.
- The flow of data, and any validation needed is controlled.
- You’ll only need to know the names of the data you’re working with, instead of the internals or types.
- The data can be moved elsewhere without affecting existing code.
- It’s reusable (API, CLI, WP Admin) and has more tests.
A new product gallery
If you haven’t been satisfied with the previous gallery’s functionality, especially on smaller screen sizes, now you will come up with a new gallery that is more functionality, far more mobile-friendly, and more intuitive.
You’ll find the following benefits:
- Visitors now have access to magnify images from the page, and zoom into them from a lightbox.
- Now it’s easy for you, if you have more than one image, because the gallery behavior is more intuitive. Clicking on a thumbnail updates the image without forcing it to open in a lightbox popup window.
- Dramatic improvements for mobile gallery views, including touch gestures – swipe to scroll through the gallery, pinch to zoom, swipe up to close, etc.
- A much smoother experience of viewing product images – now zooming on mobile displays the image’s true size.
New CLI (Command Line Interface) and Rest API v2
Now developers will meet the new CLI which is powered by the improved Rest API.
The previous CLI was powered by its own separate code and didn’t fully support the same functionality. It reduces the amout of code that we need to maintain and means that the commands will be always current.
The following benefits of a new version of the API:
- Support for metadata on most endpoints.
- New variations endpoint for creating and updating variations.
- Settings endpoint (update/view shop settings).
- Shipping zones endpoints.
- Payment and shipping methods endpoints, including settings.
- Added support for oAuth1.0a authentication using headers.
- Additional caching and removal of slow queries (last order query from the customers part of the API).
A new logging system
The new logger includes log handlers, it implements the methods described by the PSR-3 logger interface, and it’s much more extensible.
The new logger includes 2 handlers; file and database. The database handler can be enabled with:
define( 'WC_LOG_HANDLER', 'WC_Log_Handler_DB' );
Now we’d like to point out some main performance improvements into 3.0:
- Variable product sync is optimized.
- WP_Query from up-sells.php and related.php are removed and replaced with PHP foreach loop (since we already have the product IDs). This means one less large query on product and cart pages.
- The feature where old orders get access to new downloads on product edit and the ‘order items’ column on the orders page are removed. So editing a file will not prevent purchasers from downloading it.
- Rather than sending emails in one big request when placing an order on checkout, we’ve implemented a delayed CRON event to send the emails instead. This sends the emails after a small delay in a separate request and in turns speeds up the checkout by about 50% in testing.
Speaking about upgrading to and testing 3.0
Please, remember to ensure that your extensions and theme are compatible with 3.0 and you’ve made backups before upgrading. If unsure, check with the theme/extension developer.
If you’ve not yet made your extensions and themes compatible with 3.0.x (!) here are some notes we’ve been writing during our own testing:
- 6.x to 3.0.0 Developer Migration Notes
- Template changes
- Deprecated functions and filters
- Bookings extension compatibility example
- Deposits extension compatibility example
- More extension compatibility examples
“Bionic Butterfly” was going to be 2.7, which is the first important release since the plugin switched to semantic versioning. It was released after more than three months in testing period that allowed extension and theme developers enough time to get up to speed.
We hope you enjoyed reading about WooCommerce 3.0 “Bionic Butterfly”. Ready to try it? You can download the update from WooCommerce and read more about using the new features in a detailed plugin documentation.