Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WooCommerce Trends - February 2019 WooCommerce ...

WooCommerce Trends - February 2019 WooCommerce Meetup

WooCommerce is growing day by day to make itself better. Now the time has come, when the corporate arm of WordPress would be introducing a major change in managing data. We'll look forward how that is being done, its impact on current status and future regards.

Ahmedabad WordPress Meetup

February 24, 2019
Tweet

More Decks by Ahmedabad WordPress Meetup

Other Decks in Technology

Transcript

  1. Introduction “Custom Products Tables plugin that’s designed to improve the

    performance of WooCommerce stores by adding database tables that are designed for eCommerce” ➔ Why products first? ◆ Simply because it’s one of the most complex Data Stores to change, and one which can positively impact stores of all sizes. The plugin replaces the current WooCommerce product Data Store with one that makes use of brand new, normalised, dedicated product tables. It introduced CRUD (Create, Read, Update, Delete) classes for developers, making it easier to write and retrieve data from the database with less code.
  2. How CRUD works? As a simple example, let’s imagine you

    have a product and that product has a price. With the old way, if you wanted to update the price of that product then: • You need to know where that price is stored in the database (meta key) • In what format that data is stored in the database? ( either string or 2 decimal places) • You must know about how to update that data (update_post_meta)
  3. How CRUD works? With CRUD, you instead have a list

    of product properties, one of which is price, and you can call object->set_regular_price() to set the data, followed by object->save() to make that data persist in the database. Where it gets stored is none of your concern and formatting is handled automatically. For Example: $product = wc_get_product( 1 ); $product->set_regular_price( 10.99 ); $product->save();
  4. CRUD Benefits ➔ CRUD (Create, Read, Update, and Delete) classes

    to optimize data storage as this helps in writing and retrieving data. ➔ CRUD approach makes things easier for the developer to handle data Internally the data can be moved elsewhere e.g. custom tables, without affecting existing code.
  5. Experiment by Automattic Setup two identical stores on the same

    hosting provider with the same theme and WooCommerce settings, the only difference being one was running the Custom Products Table Feature Plugin. • 500 products • Storefront as the theme and no other plugins • 70,000 orders • meta data in the range of 1.4 million rows
  6. Performance Improvements ➔ The results, have been great – with

    improvements of up to 30% on page load times! ➔ Checkout, arguably the most important part of the store experience, has seen the biggest performance gains.
  7. To install the plugin you will need: ➔ Custom Products

    Table Feature Plugin (Beta Version) ◆ https://github.com/woocommerce/woocommerce-product-tables-feature-plugin/releases/ ➔ WooCommerce 3.5 Dev ◆ https://github.com/woocommerce/woocommerce/ ➔ WP-CLI ◆ To migrate products to the new data stores, you’ll need WP-CLI How to test
  8. Data Migration There are two WP-CLI commands available at present

    to migrate your data: ➔ wp wc-product-tables migrate-data [--clean-old-data]: This command will migrate data from the current WordPress tables to the new tables, passing the –clean-old-data flag will result in the old data being removed from the WordPress tables. Please be cautious when using this flag as it can result in you losing your product data if not backed up and you need to revert. ➔ wp wc-product-tables recreate-tables: This command will drop all the new product tables, removing all data within them and then create new clean tables.
  9. There are six tables added into the new plugin: ➔

    wc_products ➔ wc_product_attributes ➔ wc_product_attribute_values ➔ wc_product_downloads ➔ wc_product_relationships ➔ wc_product_variation_attribute_values “These tables currently cover all aspects of products, including product settings, attributes, variations, downloads, as well as other relationships such as up-sells, cross-sells, grouped products, and images.” What tables are added
  10. Stores product data such as price, stock, and type. This

    replaces metadata. Products are linked to POSTS by ID still so some backward compatibility is maintained.
  11. ➔ They provide backwards compatibility by adding specific functionality that

    checks meta data calls and then intervenes to ensure the data gets routed to and from the correct tables. Special Note from WooCommerce ➔ While creating plugins and themes that make direct meta calls to avoid that and rather use the getter and setter methods provided by the Data Stores since version 3.0 Compatibility with extensions and themes
  12. Can I add custom columns to the product table? Yes!

    WooCommerce Product Table supports many different column types. What about custom data??
  13. Available columns The available columns are: sku, id, name, description,

    short-description, date, categories, tags, image, reviews, stock, weight, dimensions, price, add-to-cart, and button. You can also add columns for any product attribute, custom field or custom taxonomy term. What about custom data??
  14. We guarantee compatibility between WooCommerce Product Table and Advanced Custom

    Fields (ACF) and Advanced Custom Fields Pro – these are the most popular custom fields plugins. Use the official ACF documentation to create your custom fields. When you create your custom fields, make sure you select the ‘Products’ post type. This is essential to make the custom field appear on the Add/Edit screen for your products. Custom Data & ACF
  15. We guarantee compatibility between WooCommerce Product Table and Advanced Custom

    Fields (ACF) and Advanced Custom Fields Pro – these are the most popular custom fields plugins. Use the official ACF documentation to create your custom fields. When you create your custom fields, make sure you select the ‘Products’ post type. This is essential to make the custom field appear on the Add/Edit screen for your products. Custom Data & ACF
  16. Neither WooCommerce nor the custom field plugins come with a

    way to show custom field values on the front end of your website, or the WooCommerce product page. If you’re technically minded, then you can show WooCommerce custom fields by modifying the single product page template in yourtheme/woocommerce/single-product.php. If you’re not a WordPress developer, then you can show custom fields on the WooCommerce product page using our popular Product Table plugin. Showing custom fields in the product table
  17. Release Schedule ➔ Plugin would be soon released on WordPress.org

    (Anytime this year). ➔ Any store can get benefit for the performance improvements. ➔ Do contribution and open an issue in Github Repository https://github.com/woocommerce/woocommerce-product-tables-feature- plugin/