WooCommerce 3.0 Everything You Need To Know As A User And A Developer

JUNE 30, 2017  7 MINS READ

WooCommerce 3.0 updates are majorly for the developers by keeping in mind the future of e-commerce needs. This update is aimed to improve the performance and user experience. Bionic Butterfly name of WooCommerce 3.0 has a lot of colors to add to your WooCommerce experience.

woocommerce-3-review

WooCommerce powers nearly 39% of the online stores on the internet. These updates are major, till their 3 beta versions it is been named as 2.7 version. Since the updates are major and become the foundation for next updates it is decided to give a semantic versioning upgrade 3.0

Product Gallery Update

WooCommerce 3.0 update which users can feel is the product gallery update. In fact this is the only visual update. One thing WooCommerce gallery lagging from the very beginning is the zoom feature. Which is been brought in this update.

The gallery update does not focus on image zoom alone, it is been configured for touch devices as the increased number of mobile shopping.

[recommened_reading id=”2584″ title=”Recommended Reading:”]

Features Of New Product Gallery

  • Visitors now have access to both magnification and zooming (lightbox)
    Gallery behavior is more intuitive – clicking a thumbnail updates the main image rather than opening a lightbox
  • Dramatic improvements on handheld, in particular; touch gestures – swipe to scroll through the gallery, pinch to zoom, swipe up to close, etc
  • Opening the lightbox on mobile now displays the image in its true size, larger than the in-page display

CRUD Class For Better Data Management

crud-woocommerce

CRUD stands for Create Read Update and Delete. Before the update developers need to know the where and how their data gets stored. Totally depends on the post metadata.

For example, a developer can use update_post_meta calls, direct database writes with the $wpdb class or the REST API. To manage the data and to modify it

CRUD gives developers a unified attempt to manage the data here the developer no need to worry about where or how the data is saved. The concept is simple Less code = less change to malfunction and more unit test coverage.

In short, CRUD is a layer between the database and your code which adds structure, validation, and control.

[Tweet “Less code = less change to malfunction and more unit test coverage #WooCommerce 3.0 #update”]

Features

  • Structured data for each resource is defined
  • Flow of data and any validation needed are controlled
  • As a developer, you don’t need to know the internals of the data you’re working with, just the names.
  • Once abstracted, the data can be moved elsewhere e.g. custom tables, without affecting existing
    code.
  • We can use the same code for updating things in admin as we do in the REST API and CLIs – everything is unified.

For example, if you need to update the price of a product you just need to fix the price to the product and save the changes to the database, here is how you do this with CRUD

[code language=”php”]

$product = wc_get_product( 1 );

$product->set_regular_price( 30 );

$product->save();

[/code]

See just call the product from the database, fix the new price and save it as simple as that. No more beating around the bush process.

New Command Line Interface(CLI)

new-command-line-interface

In WooCommerce 2.5 and 2.6 CLI is a separate code and does not share its feature with core WooCommerce engine. This resulted in duplication and more processing time. With the new Command Line Interface (CLI) is powered by REST API.

By building it on REST API the amount of code needs to be maintained is reduced and the code also updates when the REST API in updated.

[pro_tip title=”Following are the commands used in the current CLI”]

[code language=”php”]

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[/code]

[/pro_tip]

Improved Log System

improve-log-system

Along with this new LOG is also been used to maintain easy product log. In this new log two handles are used file and database. It helps to handle the log within the logger itself. The log messages from the core WC_logger will now be passed to the registered handler.

[pro_tip title=”Pro Tip:”]For detailed logger modifications and how to use it check the Improved logging in WooCommerce 2.7[/pro_tip]

To get a shared logger instance a new function wc_get_logger has been introduced. For example, use $logger = wc_get_logger(); to get sitewide logger instance. The wc-logger has been rewritten to work with the new handler and the PSR-3 logger interface.

After you get the wc_get_logger you can invoke different logging methods. These logging methods are called log levels. The new log levels are as follows

[pro_tip]

Emergency: system is unusable

Alert: action must be taken immediately

Critical: critical conditions

Error: error conditions

Warning: warning conditions

Notice: normal but significant condition

Informational: informational messages

Debug: debug-level messages

[/pro_tip]

New Log Handlers

The new log handlers can be defined as below

[code language=”php”]

define( ‘WC_LOG_HANDLER_File’, ‘WC_Log_Handler_DB’ );

[/code]

WC_Log_Handler_File is used to write logs on the file which will n=be shown in the WooCommerce admin status page or on the server

WC_Log_Handler_DB is used to write the log to the database from the WordPress admin page this also have some new interface updates

Changes Made To Improve Performance

As said before WooCommerce 3.0 Bionic Butterfly is the major update for developers and performance fix, following are the changes made to improve the performance.

  • Upper and lower price metadata are no longer stored
  • To make less large query on product and cart pages WP-Querry is removedfrom up-sells.php and related.php
  • Updated edited downloads, so editing a file will not prevent purchasers from downloading it. This avoids looping thousands of orders to update.
  • Delayed CRON is implemented to send an email. WooCommerce claims it speeds up the checkout by 50%. Since the emails are sent as a separate request with a small delay.
  • In WordPress multisite network, if a user is logged into one site the user is automatically logged into the other sites in the WordPress network.
    Sorting tax rates are made automatic by placing more specific rules above the general rules
  • When authorizing payments with PayPal Standard, funds are now automatically captured when the order is changed to processing or completed

[experts_box experts_title=”Easy One Click Solution:”]Get all the support and customizations for the WooCommerce. Buy WooCommerce support service[/experts_box]

Bionic Butterfly Base For Future Growth

These are some of the WooCommerce 3.0 highlights. As you can see most of the updates are towards the developer side. These updates are planned to help developers to make use of WooCommerce easily.

[recommened_reading id=”4259″ title=”Recommended Reading:”]

Bionic Butterfly WooCommerce 3.0 is a performance update and also becomes the base for forthcoming 3.0 iteration updates. From this, we can expect WooCommerce can evolve to next stage in the future updates.

Leave a Reply

Your email address will not be published. Required fields are marked *