Develop WC

The official WooCommerce development blog

WooCommerce 2.7 beta 3 — February 17, 2017
WooCommerce 2.7 beta 2 — February 9, 2017
WC 2.7 extension compatibility examples #3 – Bookings — February 6, 2017

WC 2.7 extension compatibility examples #3 – Bookings

Bookings is a complex extension which extends WooCommerce product types to add it’s own ‘Booking’ product type. Due to this, it’s a good example to CRUDify and implement data stores, both new concepts in 2.7.

Upon reviewing the current class, it’s obvious there is some room for refactoring due to the class for example rendering HTML. Ideally this should be avoided to keep the focus of the class data-only. The ideal structure is:

  • Bookings class – extends WC_Product and handles booking product data getters and setters.
  • Bookings data store – extends the core data stores to handle the storing of the booking class data to the database.
  • Functions/Display classes to handle HTML output.

Additionally, the extension needs to continue to be compatible with current 2.6.x versions of WooCommerce.

In testing, the extension actually works fine under 2.7, albeit with some notices such as:

Declaration of WC_Product_Booking::get_price() should be compatible with WC_Product::get_price($context = 'view')

These could have simply been patched on a case by case basis, but for Bookings we’ve chosen to fully CRUDify it which I’ll demonstrate in this post.

Continue reading

WooCommerce 2.6.14 security/fix release notes — February 3, 2017

WooCommerce 2.6.14 security/fix release notes

The WooCommerce 2.6.14 fix release is now available. You can download it from or as an automatic update in your administration panel.

~23 commits made it into this release fixing several issues and hardening the code in the API. The full changelog for 2.6.14 is below.

* Fix - Ensure product exists in wc_update_product_stock.
* Fix - Send emails using the site language.
* Fix - Remove tilde typo.
* Fix - Fixed notice in get_rating_count.
* Tweak - Define arg and return data types, added extra descriptions, and correctly cast IDs in the Rest API.
* Tweak - Handle custom error data in WC_REST_Exception.
* Tweak - Display conflicted product ID when using a duplicate SKU via the API.
* Localisation - Add Finnish defaults to the installer.

If you spot any further issues, please report them to us in detail on GitHub so the development team can review – comments on this post are closed.

WC 2.7 extension compatibility examples — January 17, 2017