Update HPOS CLI docs (#52552)

* Update cli-tools.md

HPOS-related CLI commands are now found under `wc hpos` instead of `wc cot`. There was also a minor change for the `verify_cot_data` sub-command, to `verify_data`.

* Clean-up of references to the `cot` subcommand.

* Update manifest (resolve conflict with other changes).
This commit is contained in:
Barry Hughes 2024-11-12 11:18:02 -08:00 committed by GitHub
parent 696c99df82
commit 22329f8aeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 28 deletions

View File

@ -710,7 +710,7 @@
"menu_title": "Design a simple extension",
"tags": "how-to",
"edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/extension-development/how-to-design-a-simple-extension.md",
"hash": "10afdef1875fb51e6163589535b6bfec86fe09624559e0dbed916e7e1c0bd777",
"hash": "5bd671921996f43d12f5be9675c3d98c59f9fc9b79d63ed3b5bad990424fbebc",
"url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/extension-development/how-to-design-a-simple-extension.md",
"id": "375f7e18a2e656e662d3189041caeb9c80e7c9e3"
},
@ -975,7 +975,7 @@
"post_title": "HPOS CLI Tools",
"tags": "reference",
"edit_url": "https://github.com/woocommerce/woocommerce/edit/trunk/docs/high-performance-order-storage/cli-tools.md",
"hash": "63e5edd55720c963de6700854515ea51946ff734b716ab61793955308b72af91",
"hash": "b9a313ba52cd08284e7a23be32c28bcb93be8f9389b0e5fcc041506ff0d2bd46",
"url": "https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/docs/high-performance-order-storage/cli-tools.md",
"id": "cdd9d9ad5777d978ba953e3478fbb61cab8fdf59"
}
@ -1823,5 +1823,5 @@
"categories": []
}
],
"hash": "1dc26e2507697f338903de7916bb1677d86d117381647c21ea228897dcff4795"
"hash": "47ff900e2d38339bf7cd36fb5f3384cc7eff6aef4a2f00953106149e3a2491a3"
}

View File

@ -4,7 +4,7 @@ tags: reference
---
## Overview
With HPOS we introduced a set of [WP-CLI commands](https://developer.woocommerce.com/docs/category/wc-cli/) living under the `wp wc hpos` and `wp wc cot` namespaces.
We have a number of [WP-CLI commands](https://developer.woocommerce.com/docs/category/wc-cli/) that can be used to manage HPOS-related functionality, all of which live under the `wp wc hpos` namespace (though you may come across blog posts and older documentation referencing the now-deprecated `wp wc cot` namespace).
The following table provides an overview of what each command does, while more details and examples can be found below.
@ -13,11 +13,11 @@ Keep in mind that the commands themselves have documentation and examples that c
|Command|Use this command to...|
|----|-----|
|`wc hpos status`|Get an overview of all HPOS matters on your site.|
|`wc cot enable`|Enable HPOS (and possibly compatibility mode).|
|`wc cot disable`|Disable HPOS (and possibly compatibility mode).|
|`wc cot count_unmigrated`|Get a count of all orders pending sync.|
|`wc cot sync`|Performantly sync orders from the currently active order storage to the other.|
|`wc cot verify_cot_data`|Verify data between datastores.|
|`wc hpos enable`|Enable HPOS (and possibly compatibility mode).|
|`wc hpos disable`|Disable HPOS (and possibly compatibility mode).|
|`wc hpos count_unmigrated`|Get a count of all orders pending sync.|
|`wc hpos sync`|Performantly sync orders from the currently active order storage to the other.|
|`wc hpos verify_data`|Verify data between datastores.|
|`wc hpos diff`|Get an user friendly version of the differences for an order between both order storages.|
|`wc hpos backfill`|Copy over whole orders or specific bits of order data from any order storage to the other.|
|`wc hpos cleanup`|Remove order data from legacy tables.|
@ -28,7 +28,7 @@ Keep in mind that the commands themselves have documentation and examples that c
Use this to get an overview of HPOS settings and status on your site. The command will output whether HPOS and compatibility mode are enabled or not, and other useful information such as orders pending sync or subject to cleanup.
**Note:** Remember that, if desired, orders pending sync can be synced using [`wc cot sync`](#wc-cot-sync) and, similarly, you can perform a cleanup on those subject to cleanup (provided compatibility mode is disabled) by running [`wc hpos cleanup all`](#wc-hpos-cleanup).
**Note:** Remember that, if desired, orders pending sync can be synced using [`wc hpos sync`](#wc-hpos-sync) and, similarly, you can perform a cleanup on those subject to cleanup (provided compatibility mode is disabled) by running [`wc hpos cleanup all`](#wc-hpos-cleanup).
#### Example 1 - HPOS status output
@ -41,7 +41,7 @@ Unsynced orders: 651
Orders subject to cleanup: 348
```
### `wc cot enable`
### `wc hpos enable`
Use this command to enable HPOS and compatibility mode (if desired) from the command line.
@ -50,46 +50,46 @@ Use this command to enable HPOS and compatibility mode (if desired) from the com
Enables HPOS and compatibility mode too (`--with-sync` flag).
```plaintext
$ wp wc cot enable --with-sync
$ wp wc hpos enable --with-sync
Running pre-enable checks...
Success: Sync enabled.
Success: HPOS enabled.
```
### `wc cot disable`
### `wc hpos disable`
Similarly to the prior command, this can be used to disable HPOS.
#### Example 1 - Attempt to disable HPOS (with orders pending sync)
If there are any orders pending sync, you won't be allowed to disable HPOS until those orders have been synced (via `wp wc cot sync`).
If there are any orders pending sync, you won't be allowed to disable HPOS until those orders have been synced (via `wp wc hpos sync`).
```plaintext
$ wp wc cot disable
$ wp wc hpos disable
Running pre-disable checks...
Error: [Failed] There are orders pending sync. Please run `wp wc cot sync` to sync pending orders.
Error: [Failed] There are orders pending sync. Please run `wp wc hpos sync` to sync pending orders.
```
#### Example 2 - Disable HPOS
```plaintext
$ wp wc cot disable
$ wp wc hpos disable
Running pre-disable checks...
Success: HPOS disabled.
```
### `wc cot count_unmigrated`
### `wc hpos count_unmigrated`
Prints the number of orders pending sync.
#### Example 1 - Obtain number of orders pending sync
```plaintext
$ wp wc cot count_unmigrated
$ wp wc hpos count_unmigrated
There are 651 orders to be synced.
```
### `wc cot sync`
### `wc hpos sync`
This command can be used to migrate orders from the posts order storage to HPOS (or viceversa) based on the current settings in WC > Settings > Advanced > Features.
That is, it'll sync orders from your currently selected datastore to the other one.
@ -101,14 +101,14 @@ If you need more control over which datastore to use as source (or destination)
#### Example 1 - Sync all orders
```plaintext
$ wp wc cot sync
$ wp wc hpos sync
There are 999 orders to be synced.
Order Data Sync 100% [============================================================================================] 0:08 / 0:08
Sync completed.
Success: 999 orders were synced in 14 seconds.
```
### `wc cot verify_cot_data`
### `wc hpos verify_data`
Use this command to check that order data in both the legacy (posts) datastore and HPOS is in sync. This is only relevant if you have "compatibility mode" enabled and orders might've been modified outside of the usual WooCommerce flows.
@ -119,7 +119,7 @@ This command operates on all orders. For a user friendlier alternative that oper
All orders are identical between datastores.
```plaintext
$ wp wc cot verify_cot_data
$ wp wc hpos verify_data
Order Data Verification 100% [====================================================================================] 0:00 / 0:00
Verification completed.
Success: 999 orders were verified in 0 seconds.
@ -130,7 +130,7 @@ Success: 999 orders were verified in 0 seconds.
An order (with ID 100126) fails verification due to differences in order total, tax, modification date and billing information.
```plaintext
$ wp wc cot verify_cot_data
$ wp wc hpos verify_data
Order Data Verification 100% [====================================================================================] 0:00 / 0:00
Verification completed.
Error: 999 orders were verified in 0 seconds. 1 error found: {
@ -169,7 +169,7 @@ Error: 999 orders were verified in 0 seconds. 1 error found: {
The verification command also admits a `--re-migrate` flag that will attempt to sync orders that have differences. This could effectively overwrite an order in the database, so use with care.
```plaintext
$ wp wc cot verify_cot_data --re-migrate
$ wp wc hpos verify_data --re-migrate
Order Data Verification 100% [====================================================================================] 0:00 / 0:00
Verification completed.
Success: 999 orders were verified in 0 seconds.
@ -177,7 +177,7 @@ Success: 999 orders were verified in 0 seconds.
### `wc hpos diff`
If you have enabled compatibility mode or migrated orders using `wp wc cot sync`, all of your orders should be in an identical state in both datastores (the legacy one and HPOS), but errors can happen. Also, manually modifying orders in the database or use of HPOS-incompatible plugins can result in orders deviating.
If you have enabled compatibility mode or migrated orders using `wp wc hpos sync`, all of your orders should be in an identical state in both datastores (the legacy one and HPOS), but errors can happen. Also, manually modifying orders in the database or use of HPOS-incompatible plugins can result in orders deviating.
The `wp wc hpos diff` tool can be used to look into those (possible) differences, which can be useful to determine whether re-migrating to/from either datastore should be done, or a more careful approach needs to be taken.
@ -234,10 +234,10 @@ wp wc hpos backfill <order_id> --from=<datastore> --to=<datastore
You have to specify which datastore to use as source (either `posts` or `hpos`) and which one to use as destination. The `--meta_keys` and `--props` arguments receive a comma separated list of meta keys and order properties, which can be used to move only certain data from one datastore to the other, instead of the whole order.
Note that `wp wc hpos backfill` differs from `wp wc cot sync` in various ways:
Note that `wp wc hpos backfill` differs from `wp wc hpos sync` in various ways:
- You can specify which order to operate on, which gives you more control for one-off operations.
- It lets you move order data between datastores irrespective of what the current order storage is in WC settings. In contrast, `wp wc cot sync` will only sync data from the current datastore to the other.
- It lets you move order data between datastores irrespective of what the current order storage is in WC settings. In contrast, `wp wc hpos sync` will only sync data from the current datastore to the other.
- In addition to letting you migrate full orders, it lets you choose which bits of data (order fields or metadata) to migrate.
#### Example 1 - Migrate a full order from HPOS to posts