Develop WooCommerce

The official WooCommerce development blog

Developer Chats. — March 17, 2017

Developer Chats.

Starting with the 3.1 release cycle, we will begin holding dev chats every 2 weeks. These meetings will happen every other Tuesday on WooCommerce Slack and are open to the community.

Each chat will have it’s own agenda, but will include topics relevant to the ongoing development of each release.

We have a few goals in mind for these chats:

  • Stay in sync, and share progress of ongoing projects.
  • Communicate more with the community and involve more people in each release cycle.
  • Increase interest and participation in contributing to WooCommerce core.

Please fill out times that would work best for you on an average Tuesday. All times are in UTC.

Once we have a time and date set for the first chat, we will announce it, including a draft agenda, and a call for additional agenda items.

Please feel free to make suggestions – these chats are for the community! :).

WC 2.7 extension compatibility examples #2 – Deposits — January 27, 2017
2.7: A new CLI for WooCommerce — December 12, 2016

2.7: A new CLI for WooCommerce

WooCommerce brings many improvements to the WP-CLI powered command-line interface we introduced back in WooCommerce 2.5.

WP-CLI is a set of command-line tools for managing WordPress installations Our WC-CLI layer adds tools for managing products, coupons, payment gateways, shipping zones, and much more.

In WooCommerce 2.5 and 2.6, the CLI was powered by it’s own separate code. This code was separate from the REST API or WC core, meaning code could end being duplicated across the code base, or it meant that certain things possible in the REST API were not possible at all with the CLI.

2.7 introduces a new CLI powered by the REST API. We did this by forking Restful. This reduced the amount of code be need to maintain, provides a lot more power and commands, and means that the commands will always be current as we improve our REST API in the future.

Currently, following commands are available with list, get, update, and create operations:

wp wc customer 
wp wc customer_download 
wp wc order_note 
wp wc payment_gateway 
wp wc product 
wp wc product_attribute 
wp wc product_attribute_term 
wp wc product_cat 
wp wc product_review 
wp wc product_shipping_class 
wp wc product_tag 
wp wc product_variation 
wp wc shipping_method 
wp wc shipping_zone 
wp wc shipping_zone_location 
wp wc shipping_zone_method 
wp wc shop_coupon 
wp wc shop_order 
wp wc shop_order_refund 
wp wc tax 
wp wc tax_class 
wp wc tool 
wp wc webhook 
wp wc webhook_delivery 

There is a wiki page containing more information and examples. We’ll also work on generating documentation similar to our REST API documentation for each command. You can also use the —help flag to find out each commands parameters.

Please test out the new CLI commands and provide feedback or bug reports on GitHub!

Payment Token API in 2.6 — April 4, 2016

Payment Token API in 2.6

WooCommerce 2.6 will ship with a payment tokenization API. This makes it easier to store, manipulate, and retrieve payment info in a standardized way. Payment methods saved using the API can be managed from the user’s account settings and are displayed as options during checkout. The Simplify gateway also now has support for tokens meaning users can save their payment information for future purchases.

Sound good? Check out the docs to learn more and get started.

What are Payment Tokens?

Payment tokens in WooCommerce allow you to save the tokens/keys you use for communicating with various payment processors. They also store the other meta information needed to process a payment. For example, credit card tokens store the four digits of a card, the card brand/type, and expiration information. eChecks store their last four digits. New types of tokens can be easily built and used with WooCommerce.

When can I use it?

The Payment Token API will ship with WooCommerce 2.6 which is due for release in Q2 2016.

Please feel free to experiment and test with this functionality from Github master branch and provide feedback on GitHub. The Payment Token API documentation should contain everything you need to know. You can also look at examples in the unit tests, or by looking at the Simplify Commerce gateway code.

Can you give me an example?

The Payment Token API docs cover examples and the available classes comprehensively, but here is an example of how easy it is to build and save a token to a user’s account:

// Build the token
$token = new WC_Payment_Token_CC();
$token->set_token( $payment_token_from_gateway ); // Token comes from payment processor
$token->set_gateway_id( 'paypal' );
$token->set_last4( '1517' );
$token->set_expiry_year( '2018' );
$token->set_expiry_month( '06' );
$token->set_card_type( 'visa' );
$token->set_user_id( get_current_user_id() );
// Save the new token to the database
$token->save();
// Set this token as the users new default token
WC_Payment_Tokens::set_users_default( get_current_user_id(), $token->get_id() );
Google Analytics Integration 1.4 Beta — July 31, 2015

Google Analytics Integration 1.4 Beta

A new version of the Google Analytics plugin for WooCommerce is now ready for testing. You can download beta 1 here: https://github.com/woothemes/woocommerce-google-analytics-integration/archive/1.4.0-beta-1.tar.gz

Release Highlights

Enhanced eCommerce The new plugin now supports enhanced eCommerce tracking. Enabling enhanced analytics allows you to gather information every step of the way. You can now track: Purchase transactions, when an item is added to the cart, when an item is removed from the cart, product impressions from listing pages, product clicks from listing pages, when a product is viewed from its page, and when the checkout process is initiated.

Setup Tips The Google Analytics plugin can take a few steps to configure correctly since you need to configure things from the Google Analytics dashboard as well. The new release tries to make this as clear as possible by offering tips after installing the plugin, and clearer explanations around the different settings.

The plugin has also been refactored to make adding features like enhanced eCommerce possible (and to make it easier to potentially track more information in the future). Since the code has shifted a bit, we wanted to get some feedback on a beta version before releasing to everybody. If you find a bug, please post an issue on GitHub.