Develop WooCommerce

The official WooCommerce development blog

WooCommerce 3.3.5 fix release notes — April 10, 2018

WooCommerce 3.3.5 fix release notes

WooCommerce 3.3.5 is now available. ~32 commits made it into this release and the full changelog is below.

* Fix - Shop page notice should not appear when edting the "Hello World!" page.
* Fix - Inconsistent order item refund sign.
* Fix - Change `wc_get_price_excluding_tax` to not round the return value so calculations in admin are not pre-rounded.
* Fix - Use minimum price instead of maximum price when ordering variable products from low to high on term archives.
* Fix - `order` and `orderby` on shop page when using rewrite rules.
* Fix - Ajax loading spinner when using twentyseventeen theme.
* Fix - Out of Stock products change stock to On Backorder when imported to update existing products.
* Fix - Visibility dropdown not responding in quick edit when stock management is disabled.
* Fix - Featured paramenter in products endpoint on REST API.
* Fix - Linebreaks in order item meta.
* Fix - Product rating count when updated by admin.
* Tweak - Define array before attempting to append to it.
* Tweak - Change WC WP-CLI commands default per_page value to 100.
* Tweak - Ensure background process class returns `data` as an array.
* Tweak - Increase orders table checkbox column size on small devices.
* Tweak - Better support for infinite scroll in Jetpack.

 

Download the latest release of WooCommerce here or venture over to Dashboard → Updates to update your plugins from WordPress.

As usual, if you spot any other issues in WooCommerce core please log them in detail on Github, and to disclose a security issue to our team, please submit a report via HackerOne here. Comments on this post are closed.

WC 3.3 New Webhooks CRUD — December 8, 2017

WC 3.3 New Webhooks CRUD

We have been talking a lot about CRUD since 3.0.0, and the reason is because we want move certain features from the WordPress post database table to new database tables. This improves the performance and scalability of those features. Starting with 3.3.0, our webhooks will not use the posts and comments database tables anymore, and we finally have our first feature migrated to custom tables!

New Webhooks CRUD

Webhooks are a feature that 3rd party developers do not use often or heavily customize, so this make it easy to start moving all of the necessary data for webhooks to a new table.

With CRUD it is now easier to manipulate webhooks too:

// Creating a new webhook.
$webhook = new WC_Webhook();
$webhook->set_user_id( 1 ); // User ID used while generating the webhook payload.
$webhook->set_topic( 'order.created' ); // Event used to trigger a webhook.
$webhook->set_secret( 'secret' ); // Secret to validate webhook when received.
$webhook->set_delivery_url( 'https://webhook-handler.com' ); // URL where webhook should be sent.
$webhook->set_status( 'active' ); // Webhook status.
$webhook->save();

// Updating webhook:
$webhook = wc_get_webhook( $webhook_id );
$webhook->set_status( 'disabled' );
$webhook->save();

// Deleting webhook:
$webhook = wc_get_webhook( $webhook_id );
$webhook->delete( true );

Webhook delivery logs

Delivery logs have been moved from the WordPress comments table to our logging system, which allows more options for handling them instead of having to access the webhook logs in the admin interface.

Note: Because of this change all REST API endpoints for webhook delivery logs are now deprecated and will always return as empty. This is because logs now can be saved in the database, as files, or anything else.

Use your favorite message queue tool to process webhooks

It is now possible to write custom code to process webhooks. We used to only have options to deliver a webhook as soon as it is triggered or by WP CRON, but that may not be good for everyone. Until we have a third option with our “event queue” you may want to use Redis, Amazon SQS or something else.

It’s possible to override the delivery like so:

remove_action( 'woocommerce_webhook_process_delivery', 'wc_webhook_process_delivery', 10 );

/**
 * Custom process webhook delivery.
 *
 * @param WC_Webhook $webhook Webhook instance.
 * @param array      $arg     Delivery arguments.
 */
function my_custom_wc_webhook_process_delivery( $webhook, $arg ) {
	// Your custom code here.
	// Just do not forget to trigger webhook with later:
	// $webhook->deliver( $arg )
	// Or get the webhook payload as JSON and send with your own delivery method:
	// wp_json_encode( $webhook->build_payload( $arg ) )
	// Note that custom delivery methods will require extra code to log deliveries with $webhook->log_delivery( $delivery_id, $request, $response, $duration )
}
add_action( 'woocommerce_webhook_process_delivery', 'my_custom_wc_webhook_process_delivery', 10, 2 );

And that’s all folks 👋.

WooCommerce 3.2 RC2 — October 5, 2017

WooCommerce 3.2 RC2

WooCommerce 3.2.0 RC2 is available for testing. This includes a few small fixes.

To test WooCommerce 3.2.0 RC2, you can use our WooCommerce Beta Tester plugin or you can download the release candidate here (zip).

Think you’ve found a bug? Please post in detail to Github.

The final version of 3.2 is due for release October 11th 2017. Huge props to everyone who has sent feedback about this release so far or found bugs.

WooCommerce 3.2 RC1 — September 27, 2017
August 15th: Dev chat #9 — August 12, 2017

August 15th: Dev chat #9

The next chat will be on August 15th 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 request an invite at the bottom of the WooCommerce developers page.

Here is the agenda:

  • 3.2 progress
  • SelectWoo

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

See you there!

p.s. if you missed something in the last dev chat, you can recap our summary here.