Hello! My name is Justin Shreve.
I'm a web developer in Oregon. I'm an engineer at Automattic, the company behind WordPress.com.
My Life, Tagged:
web developer, music fan, WordPress contributor, speaker, php coder, automattician, writer, traveler, amateur photographer, code wrangler.
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:
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
// Set this token as the users new default token
WC_Payment_Tokens::set_users_default( get_current_user_id(), $token->get_id() );
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.