WooCommerce 2.7 codename “Bionic Butterfly” has been tagged in GitHub and is ready for testing!
This is a major release with large structural changes to help us work towards a more performant platform. There have been over 1900 commits from 16 contributors since July!
You can download WC 2.7 Beta 1 here.
( @ \v/ m ) \__+|+__/ {_/ \_}
Release highlights
Create Read Update Delete (CRUD) functions
The largest change in 2.7 for developers is the new CRUD system. CRUD is an abbreviation of the 4 basic operations you can do to a database or resource – Create, Read, Update, Delete.
In 2.7 we have CRUD classes in place for orders, products, customers, line items, shipping zones, payment tokens, and coupons.
We’ll be posting some follow up posts on this blog about switching to CRUD in the near future so stay tuned.
You can read more about the new CRUD classes here.
New product gallery
2.7 introduces a new image gallery on single product pages. We took a poll to see what users wanted, and went with a zoom/swipe hybrid approach for improved mobile support.
- Visitors now have access to both magnification and zooming (lightbox)
- Gallery behaviour is more intuitive – clicking a thumbnail updates the main image rather than opening a lightbox
- Dramatic improvements on handheld, in particular; touch gestures – swipe to scroll through the gallery, pinch to zoom, swipe up to close, etc
- Opening the lightbox on mobile now displays the image in it’s true size, larger than the in-page display 🎉
You can read more about the new gallery here.
CLI powered by REST API.
In the same way we’ve cut down on code by making the API use CRUD classes, we thought it was time to unify the REST API and the CLI so we don’t have duplicate code throughout the project. The new CLI supports (almost) everything the REST API can do.
You can read more about the new CLI here.
REST API updates
We’ve added some new endpoints to the REST API:
- One specifically for variations. In addition, we’ve prevented the (broken) ability to manipulate variations directly on the products endpoints. Variation endpoints should be used instead.
- One to update and view settings.
- Endpoints for shipping zones.
- Endpoints for payment and shipping methods and settings.
Additionally, we’ve added support for oAuth1.0a authentication using headers, and removed a very slow last order query from the customers part of the API due to performance concerns. You can use the orders endpoint instead. Other order data on the endpoint is now transient cached.
We’ll update the REST API docs with these soon.
Performance improvements
Joining to the post meta table can cause significant slowdown when you have a large product catalog so we’ve made some optimisations to utilise taxonomies more for frontend product filters.
Product visibility (which controls if products are visible in the catalog, search, or both) was previously post meta, and was used in all WooCommerce product queries. In 2.7 this is a new product_visibility taxonomy instead. In testing, with ~8k products we saw speed improvements of around 94%.
Featured products are also using the new product_visibility taxonomy instead of meta which improves queries on those.
And the same for out of stock products. If you’re hiding out of stock products from your catalog, you’ll see improvements.
Meta to taxonomy conversions are handled by our upgrade script.
For variable products specifically, we’ve tried to optimise variable product sync. Upper/lower price meta data is no longer stored (it was not used in core), just the main prices, if a child has weight, and if a child has dimensions.
In our template files, we’ve removed WP_Query from up-sells.php and related.php and replaced with PHP foreach loop (since we already have the product IDs). This means one less large query on product and cart pages.
Finally, we’ve removed the feature where old orders get access to new downloads on product edit. Looping (potentially) thousands of orders to do this update was too much of a performance burden for some stores and this also could lead to unexpected behaviour. After this update we do however update edited downloads, so editing a file will not prevent purchasers from downloading it.
Other improvements
- Sorting tax rates was previously a manual process. When you have pages of tax rates this becomes cumbersome. In 2.7.x we sort tax rates automatically, placing more specific rules above more general rules (the way they should be sorted).
- On the frontend, we’ve made the storewide notice dismissible making it less of an issue whene it overlaps content on mobile 🙂
- On WordPress networks/multisite, when a user logs into a store with an account, but not an account on the current store, WooCommerce will add existing users to the store rather than throw an error as it did in 2.6.
- Previously, structured data was output inline in our template files (marking up things such as products). In 2.7 we’ve switched to JSON-LD format which keeps our template files tidy and keeps data intact if customisations are made by theme developers.
- When using authorizations in PayPal Standard, funds are now automatically captured when the order is changed to processing or completed.
- We merged cart percent and product percent coupon types into one and removed product_cart discounts. The discounts these coupons provide are identical, however, the cart based validation would stop the coupon being applied if any non-eligble item was in the cart, rather than just discounting eligible items like product coupons do. This was not intuitive, caused store owner and confusion, and most important of all, just meant users would have to checkout twice to make use of these coupons (thats not fair nor ideal).
There are many more smaller tweaks and improvements in 2.7 but this covers the main changes that you may notice.
Template changes in 2.7.0
File | Description |
---|---|
cart/cart.php |
CRUD compatibility. |
cart/cross-sells.php |
Removes WP_Query for performance reasons. |
checkout/thankyou.php |
Mark |
emails/email-order-items.php |
CRUD compatibility. |
emails/plain/email-order-items.php |
CRUD compatibility. |
myaccount/downloads.php |
Improved download table layout. |
order/order-details-customer.php |
CRUD compatibility. |
order/order-details-item.php |
CRUD compatibility. |
order/order-details.php |
CRUD compatibility. |
single-product/add-to-cart/grouped.php |
Checks grouped products exist correct, and CRUD compatibility. |
single-product/meta.php |
CRUD compatibility. |
single-product/photoswipe.php |
Handles the new photoswipe gallery. |
single-product/price.php |
CRUD compatibility. |
single-product/product-attributes.php |
CRUD compatibility. |
single-product/product-image.php |
New image gallery. |
single-product/product-thumbnails.php |
New image gallery. |
single-product/related.php |
Removes WP_Query for performance reasons. |
single-product/review-meta.php |
CRUD compatibility. |
single-product/review-rating.php |
CRUD compatibility. |
single-product/stock.php |
New template to output stock HTML. |
single-product/tabs/additional-information.php |
CRUD compatibility. |
Deprecated functions and methods in 2.7.0
Functions:
woocommerce_get_product_schema
_wc_save_product_price
- All methods in the legacy (backwards compatibility) classes:
Filters:
Filter | Replacement |
---|---|
woocommerce_email_order_schema_markup |
woocommerce_structured_data_order |
add_to_cart_fragments |
woocommerce_add_to_cart_fragments |
add_to_cart_redirect |
woocommerce_add_to_cart_redirect |
woocommerce_product_width |
woocommerce_product_get_width |
woocommerce_product_height |
woocommerce_product_get_height |
woocommerce_product_length |
woocommerce_product_get_length |
woocommerce_product_weight |
woocommerce_product_get_weight |
woocommerce_get_sku |
woocommerce_product_get_sku |
woocommerce_get_price |
woocommerce_product_get_price |
woocommerce_get_regular_price |
woocommerce_product_get_regular_price |
woocommerce_get_sale_price |
woocommerce_product_get_sale_price |
woocommerce_product_tax_class |
woocommerce_product_get_tax_class |
woocommerce_get_stock_quantity |
woocommerce_product_get_stock_quantity |
woocommerce_get_product_attributes |
woocommerce_product_get_attributes |
woocommerce_product_gallery_attachment_ids |
woocommerce_product_get_gallery_image_ids |
woocommerce_product_review_count |
woocommerce_product_get_review_count |
woocommerce_product_files |
woocommerce_product_get_downloads |
woocommerce_get_currency |
woocommerce_order_get_currency |
woocommerce_order_amount_discount_total |
woocommerce_order_get_discount_total |
woocommerce_order_amount_discount_tax |
woocommerce_order_get_discount_tax |
woocommerce_order_amount_shipping_total |
woocommerce_order_get_shipping_total |
woocommerce_order_amount_shipping_tax |
woocommerce_order_get_shipping_tax |
woocommerce_order_amount_cart_tax |
woocommerce_order_get_cart_tax |
woocommerce_order_amount_total |
woocommerce_order_get_total |
woocommerce_order_amount_total_tax |
woocommerce_order_get_total_tax |
woocommerce_order_amount_total_discount |
woocommerce_order_get_total_discount |
woocommerce_order_amount_subtotal |
woocommerce_order_get_subtotal |
woocommerce_order_tax_totals |
woocommerce_order_get_tax_totals |
woocommerce_refund_amount |
woocommerce_get_order_refund_get_amount |
woocommerce_refund_reason |
woocommerce_get_order_refund_get_reason |
default_checkout_country |
default_checkout_billing_country |
default_checkout_state |
default_checkout_billing_state |
default_checkout_postcode |
default_checkout_billing_postcode |
Release schedule and beta testing
Beta 1 is out today (December 15th). Subsequent betas will be released as needed and we’ll post on this blog if this happens.
We hope to have a release candidate ready by February.
If you’d like to help test, you should download the release from Github. We posted a nice little write-up on beta testing here which should get you started. Please read that and jump right in!
If you’re like to help translate 2.7, you’ll find it on the development branch on https://translate.wordpress.org/projects/wp-plugins/woocommerce.
Thanks to all of our testers and contributors.
Leave a Reply