Develop WooCommerce

The official WooCommerce development blog

WooCommerce 3.0.5 fix release notes — April 28, 2017

WooCommerce 3.0.5 fix release notes

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

~44 commits made it into this fix release. The full changelog is below.

* Fix - Tooltip display within shipping zone modals.
* Fix - Fix missing title for actions column on mobile.
* Fix - Allow forward slash in telephone field.
* Fix - Sort grouped products by menu order when displaying.
* Fix - Fix term exclusion in term count queries.
* Fix - Filter invalid products before returning them for wc_get_products.
* Fix - Prevent orders being their own parent (causes errors).
* Fix - Correctly migrate legacy shipping taxes data.
* Fix - Make sure the meta data cache is not shared among instances.
* Fix - Correct the stock display notice when a variable product manages stock for it's children.
* Fix - On multisite, add user to blog during checkout if not a user to prevent errors.
* Fix - Correct sale price date handling with some timezone setups.
* Fix - wc_attribute_taxonomy_id_by_name needs to use lowercase attribute slug to work.
* Fix - Make changes to the buyer's company name in the shipping section of checkout persist.
* Tweak - Add required placeholder for meta fields in backend.
* Tweak - Don't strtolower address strings on checkout validation messages.
* REST API - Prevent password change notification when creating a customer.
* REST API - Removed duplicated items returned in shipping and checkout endpoints.
* CLI - Fixed missing shipping zones route.
* Dev - Make get_price_html handling match 2.6 and pass all values through woocommerce_get_price_html filter.
* Dev - Legacy customer class missing get_address / get_address_2 functions.
* Dev - Restored filter woocommerce_checkout_customer_id during checkout validation.
* Dev - Adds missing $this argument for all woocommerce_payment_complete_order_status filters.

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.

Dev Chat Summary: April 25th — April 27, 2017

Dev Chat Summary: April 25th

This post summarizes the dev chat meeting from April 25th. (agenda, Slack archive).

Product Admin UI

  • Mock-up of proposed redesign.
  • The UI changes are primarily to reduce confusion with new users.
  • Product data panel remains the same.
  • Primary concerns are about existing plugins that add fields still being compatible with the redesign, especially the price fields area.
  • Auto-generating SKUs will be tricky to get right.

CRUD Search Helpers

  • Standardized way for developers to get information out of the database without having to worry about the actual database structure.
  • Information will be retrieved using WC_Object_Query objects similar to WP_Query.
  • This is under development now. See this pull request for an initial implementation.
  • WC_Object_Query objects support querying by props and a subset of the parameters WP_Query supports.
  • 3.1 will have Order and Product queries.

Importer / Exporter

  • Please provide feedback on the proposed schema.
  • Fields that don’t match a known field get imported as meta data.
  • Handling of serialized data is a concern.
  • We need to work out a good solution for a long-running import. One option is a background process with periodic polling to get the status.
April 25th: Second Dev Chat — April 18, 2017

April 25th: Second Dev Chat

Last week was our first developer chat. Thanks to everyone that attended. If you weren’t able to be there, you can read the summary.

Our second dev chat will be on April 25th at 16:00 UTC in the #core channel of the WooCommerce Community Slack. If you don’t already have access to the group, you can get an invite at the bottom of the WooCommerce developers page.

We will be doing further work on topics from last time. Here is the agenda:

If you have anything to propose for the agenda or related to the above, please leave a comment below.

See you there!

End-to-end testing WooCommerce — March 30, 2017

End-to-end testing WooCommerce

It is important for developers to be able to easily and quickly test new versions of WooCommerce. The Core Testing Checklist has 30 items in it, and is a manual process. Running through the whole thing is tedious and time consuming, so automating the process would be a big improvement.

End-to-end (e2e) testing tests whether the whole flow of an application is working as expected, and will be an important part in ensuring changes don’t break anything. It automates the manual process of going through all of the different customer-facing and admin-facing pages, performing actions on those pages, and verifying those actions do what is expected.

We have developed an e2e testing suite that should dramatically reduce the time it takes to run through tests before big releases. It works by navigating around a site with ChromeDriver. ChromeDriver simulates a real user by moving the mouse around, clicking on things, and entering input into forms. The results of these actions get compared to the expected results, and the test suite can then determine whether the action was successful. Since this is programmatic, testing can be completed much faster than humanly possible.

The initial release of the testing suite covers some of our core testing checklist, but not yet all of it. Developers are welcome and encouraged to contribute new tests.

Usage

You can use the test suite included in the WooCommerce GitHub repository for testing the base WooCommerce plugin. Follow the Getting Started guide to set up your environment for e2e testing.

You can also use the tests for verifying that an extension didn’t break core WooCommerce functionality. To do this, activate the extension before running the tests. If the tests pass, it will verify that the activated extension did not break functionality covered by the tests.

Please note: this may not work well with some extensions that drastically change the WooCommerce flow or change certain html elements because the tests expect to be able to click on specific elements and have them act in a predetermined way.

Adding end-to-end tests to extensions.

The WooCommerce test suite is built on top of a library we’ve developed for simplifying WooCommerce e2e testing. The library contains a collection of JavaScript objects that can be used for performing common actions on WooCommerce screens, and the objects can be easily extended to add new, custom user actions. You can write test suites for your extensions and dramatically cut down on the amount of time you spend manually testing!

Here is a simple test example using the library:


// Create a new Shop page object.
const shopPage = new ShopPage( 
    driver, 
    { 
        url: manager.getPageUrl( '/shop' ) 
    } 
);

// Click the "Add to Cart" button for "Flying Ninja".
shopPage.addProductToCart( 'Flying Ninja' );

// Create a new Cart page object.
const cartPage = new CartPage( 
    driver, 
    { 
        url: manager.getPageUrl( '/cart' ) 
    } 
);

// Verify the cart has the items.
assert.eventually.ok( cartPage.hasItem( 'Flying Ninja' ) );

To help you get started with extension e2e testing, we’ve written a helpful tutorial that introduces the library, setting up your environment, writing tests for customer-facing screens, and writing tests for admin-facing screens. Read the tutorial to get started! If you run into any questions about objects or their methods, there is also API documentation.

Contributing

If you encounter any bugs in the library or want to contribute, you can do that here.