Contents

WP-CLI - Plugixa Inventory

Two commands, under wp plugixa-inventory stock. Both are the terminal half of something the admin can also do, and both exist for reasons rather than for completeness.

Why there is a CLI

A rebuild over fifty thousand items will outlive any request timeout. The REST route is right for a single item and for the daily report; it is the wrong shape for the whole-site run somebody does after a migration, and giving that run a browser tab to die in is not a design.

--repair-balances rewrites an audit column. It should not be one click away from a screen. Requiring shell access is a real gate that no capability check replicates.

reconcile

Check every stored quantity against the stock ledger.

wp plugixa-inventory stock reconcile
wp plugixa-inventory stock reconcile --item=44
wp plugixa-inventory stock reconcile --apply --repair-balances
Flag Does
--item=<id> Restrict the check to one item
--apply Correct the per-warehouse quantities from the ledger. Without this the command only reports
--repair-balances Additionally correct the cached per-item totals
--format=<format> table (default), json, csv or yaml

Without --apply nothing is written. That is the default on purpose: read the findings first, because a difference is evidence of something, and correcting it before reading it throws the evidence away.

--format=json makes the command usable from a deploy script or a monitor.

seed-layers

Open cost layers for stock that predates the costing method.

wp plugixa-inventory stock seed-layers
wp plugixa-inventory stock seed-layers --item=44

It only does anything under FIFO or LIFO costing. It reconstructs each item and warehouse pair’s layers from the ledger’s own receipts, so both the ages and the costs are the real ones rather than today’s.

On an average-costing site it runs, finds nothing to do, and says so. That is honest rather than an error: there are no layers to open.

Note the hyphen. The subcommand is seed-layers.

The same rules as the screen

Neither command holds any logic of its own. They parse flags, call the same stock engine the REST routes call, and print a table.

Every rule about what may be repaired lives on the engine, so the command and the admin screen cannot drift into disagreeing about what --apply means. What the Stock health panel will not rewrite - cost layers, and the history of which receipt paid for which removal - the CLI will not rewrite either.

Where to run it

cd /path/to/wordpress
wp plugixa-inventory stock reconcile

On a multisite, add --url=. On managed hosting, WP-CLI is usually available over SSH; the admin panel is there for when it is not.

Troubleshooting

Symptom Usual cause
“‘plugixa-inventory’ is not a registered command” The plugin is not active on the site WP-CLI is pointed at, or --url= is missing on multisite.
“Did you mean ‘seed_layers’?” Use the hyphen: seed-layers.
reconcile found differences but changed nothing Correct. Add --apply once you have read them.
seed-layers did nothing The site is on average costing. There are no layers.
The run takes a long time It is walking the whole ledger. That is what it is for; use --item to narrow it.
Cached totals still look wrong after --apply Add --repair-balances.
It reports layer differences and will not fix them By design. Which receipt paid for which removal cannot be recomputed.

What to do next

Quick Links