You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 15, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Contributing to WooCommerce Custom Order Tables
1
+
# Contributing to WooCommerce Custom Orders Table
2
2
3
-
Thank you for your interest in WooCommerce Custom Order Tables!
3
+
Thank you for your interest in WooCommerce Custom Orders Table!
4
4
5
5
6
6
## Reporting bugs and/or suggesting new features
@@ -44,9 +44,9 @@ Once master has been updated, the release should be tagged, then `master` should
44
44
45
45
### Unit testing
46
46
47
-
WooCommerce Custom Order Tables uses [the WordPress core testing suite](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/) to provide automated tests for its functionality.
47
+
WooCommerce Custom Orders Table uses [the WordPress core testing suite](https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/) to provide automated tests for its functionality.
48
48
49
-
When submitting pull requests, please include relevant tests for your new features and bugfixes. This helps prevent regressions in future iterations of the plugin, and helps instill confidence in store owners using this to enhance their WooCommerce stores.
49
+
When submitting pull requests, please include relevant tests for your new features and bug-fixes. This helps prevent regressions in future iterations of the plugin, and helps instill confidence in store owners using this to enhance their WooCommerce stores.
@@ -10,12 +10,60 @@ WooCommerce even with CRUD classes in core, still uses a custom post type for or
10
10
### Here's how
11
11
WooCommerce saves more than 40 custom fields per order— including those from plugins— inside the wp_postmeta table. If your store gets ~40 per day, that's 1600 rows (40 * 40) added to the postmeta table in a day.
12
12
13
-
In one month that number can be 48,000 new rows (1600 * 30) added to your postmeta table. The more rows in a table the longer it will take for a query to execute. WooCommerce Order Tables creates a new table for WooCommerce orders which would cut that number tremendously by making each custom field into a column so that 1 order = 1 row.
13
+
In one month that number can be 48,000 new rows (1600 * 30) added to your postmeta table. The more rows in a table the longer it will take for a query to execute. WooCommerce Custom Orders Table creates a new table for WooCommerce orders which would cut that number tremendously by making each custom field into a column so that 1 order = 1 row.
14
14
15
15
## Installation
16
16
This plugin uses a Composer autoloader. If you are working with code from the `master` branch in a development environment, the autoloader needs to be generated in order for the plugin to work. After cloning this repository, run `composer install` in the root directory of the plugin.
17
17
18
18
The packaged version of this plugin, which is available in [releases](https://github.com/liquidweb/WooCommerce-Order-Tables/releases), contains the autoloader. This means that end users should not need to worry about running the `composer install` command to get things working. Just grab the latest release and go, but be sure to backup your database first!
19
19
20
-
## How to use
21
-
To be able migrate orders that are stored in the post type `shop_order` on your store, you will need to run a couple of WP-CLI commands. This plugin includes two WP-CLI commands, one is for getting how many orders have not been migrated yet into the order table `wp wc-order-table count`. The other WP-CLI command is to migrate the orders to the `woocommerce_order` database table, that command is `wp wc-order-table migrate --batch=500 --page=1`. So the default batch number of the orders to process is 1000, so you can adjust the batch number as needed.
20
+
## Migrating order data
21
+
22
+
After installing and activating the plugin, you'll need to migrate orders from post meta into the newly-created orders table.
23
+
24
+
The easiest way to accomplish this is via [WP-CLI](http://wp-cli.org/), and the plugin ships with three commands to help:
25
+
26
+
### Counting the orders to be migrated
27
+
28
+
If you'd like to see the number of orders that have yet to be moved into the orders table, you can quickly retrieve this value with the `count` command:
29
+
30
+
```
31
+
$ wp wc-order-table count
32
+
```
33
+
34
+
### Migrate order data from post meta to the orders table
35
+
36
+
The `migrate` command will flatten the most common post meta values for WooCommerce orders into a flat database table, optimized for performance.
37
+
38
+
```
39
+
$ wp wc-order-table migrate
40
+
```
41
+
42
+
Orders are queried in batches (determined via the `--batch-size` option) in order to reduce the memory footprint of the command (e.g. "only retrieve {$size} orders at a time). Some environments may require a lower value than the default of 1000.
43
+
44
+
#### Options
45
+
46
+
<dl>
47
+
<dt>batch-size</dt>
48
+
<dd>The number of orders to process in each batch. Default is 1000 orders.</dd>
49
+
</dl>
50
+
51
+
52
+
### Copying data from the orders table into post meta
53
+
54
+
If you require the post meta fields to be present (or are removing the custom orders table plugin), you may rollback the migration at any time with the `backfill` command.
55
+
56
+
```
57
+
$ wp wc-order-table backfill
58
+
```
59
+
60
+
This command does the opposite of `migrate`, looping through the orders table and saving each column into the corresponding post meta key. Be aware that this may dramatically increase the size of your post meta table!
61
+
62
+
#### Options
63
+
64
+
<dl>
65
+
<dt>batch-size</dt>
66
+
<dd>The number of orders to process in each batch. Default is 1000 orders.</dd>
67
+
<dt>batch</dt>
68
+
<dd>The batch number to start from when migrating data. Default is 1.</dd>
0 commit comments