Performance ImprovementsDuring our tests we set up 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. To test the new product tables we needed to easily create a lot of store data – specifically products, orders, and customers. To do that, we created the WooCommerce Smooth Generator – an easy to use development plugin which allows you to generate WooCommerce data to test the scalibilty of any of your development. For the tests, we created one data set of 500 products and imported that into two identical stores with Storefront as the theme and no other plugins – one store with the normal WooCommerce data structures and the other with our new feature plugin. Both stores also had 70,000 orders in the database and meta data in the range of 1.4 million rows. The results, so far, 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.
Installing the pluginTo install the plugin you will need :
- Custom Products Table Feature Plugin : Download the Version 1 release.
- WooCommerce 3.5 Dev : You’ll need to switch to the master branch of WooCommerce.
- WP-CLI : To migrate products to the new data stores, you’ll need WP-CLI.
Data MigrationThere 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 loosing 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. This command is useful for testing the migration process from fresh again should you wish. Again, please be cautious as if you ran the migrate-data command with the –clean-old-data flag, running this will result in all your data being lost, so always keep a backup on hand of your products. Do note that any new products created after you have enabled the plugin will be created in the new tables and will not be available if you disable the plugin again.
What tables are added
- wc_products – Contains product data eliminating the majority of meta data table storage. A few fields in the meta data table not accessed often, and all extension specific data, will stay in meta data.
- wc_product_attributes – Contains product attributes and their settings.
- wc_product_attribute_values – Contains product attribute values and their settings.
- wc_product_downloads – Contains product downloads and their settings.
- wc_product_relationships – Contains all product relationships to other products or objects within the WooCommerce ecosystem, i.e. other products, images etc.
- wc_product_variation_attribute_values – Contains variation data for products.