# Orders, products and stock

> Check store health, find out why an order is stuck or failed, change prices and stock in bulk with a preview, and roll the whole batch back if needed.

Your AI app can check your store the way a developer would: order statuses, failed payments, stuck background jobs, product data and stock. It can also change prices and stock for many products at once, with a table you approve first and a one-step undo for a whole batch of up to 100 items.

## What you need

- **Read-only diagnostics** covers the checks in steps 1 to 4, on the Free plan too. Personal data stays out of the answers by default.
- **Content & store data** to change products, prices, stock and orders.
- **Settings & maintenance** to run a failed scheduled action again, run a WooCommerce tool, or change payment, tax or shipping settings. The built-in recipes touch those settings only when you name them, and they place no test orders.

## Before you start

- Orders and customers contain personal data. Ask by order number, not by name. Whatever your app reads reaches your AI provider; see [Data and privacy](/docs/security/data/). `wc_order_inspect` masks the customer's e-mail and leaves out the IP address, browser, names, street, city and postcode, unless the app is told to include the full address.
- Before a bulk change, set a checkpoint. For more than a hundred items or for database-wide work, also make a database backup. See [Work safely on a live site](/docs/guides/safe-workflow/).
- Changing an order's status can send e-mails to the customer or to you, and cancelling an order returns stock. Say so in your request if that matters.

## Steps

:::steps
1. **See the store at a glance.**
   - Example prompt: `Give me a health check of my store for the last 7 days: orders by status, failed and stuck orders, stock problems, payment gateways, and failed background jobs. Change nothing.`
   - Your AI app will use `wc_overview` and `wc_status`. If the answer says the Analytics tables lag behind, do not rely on its revenue numbers.
2. **Find out why an order is stuck or failed.**
   - Example prompt: `Order #1042 is stuck in "processing". Why? Read the order notes and the related background jobs. Don't change the order.`
   - Your AI app will use `wc_order_inspect` (status, totals, payment method, items, notes in the order they were added, refunds, related scheduled actions), `wc_scheduled_actions` and `error_log_read` for the WooCommerce logs.
3. **Look at the queue.** A stuck queue delays status changes, e-mails and webhooks.
   - Example prompt: `Are any WooCommerce scheduled actions failed or past due? Which ones, and why?`
   - Your AI app will use `wc_scheduled_actions` with the status `failed` or `past-due`. To run a failed action again, `wc_scheduled_action_manage` needs your approval, because a retry can send an e-mail.
4. **Check a product that misbehaves.**
   - Example prompt: `Why can customers not add the Cast Iron Skillet to the cart? Check its prices, stock settings and variations.`
   - Your AI app will use `wc_product_inspect`. It compares the stored price with the lookup tables and reports problems such as a variable product with no purchasable variations.
5. **Change prices in bulk, with a preview.** The app reads the products, shows a table, and waits.
   - Example prompt: `Raise the prices of everything in Kitchen by 5 percent and round to .99. Show me a table with the product, the current price and the new price first. Skip any product where the sale price would end up above the new price.`
   - Your AI app will use `rest_request` to read products and, after your OK, `checkpoint_create` and a batch update (`POST /wc/v3/products/batch`). It starts with 3 to 5 items, checks them, then does the rest in batches of up to 100.
6. **Fix stock from a list.**
   - Example prompt: `Here is my stock list as SKU and quantity: [paste]. Match every SKU, show me the current and new stock in a table, and list the SKUs that match nothing. Wait for my OK.`
   - Your AI app will use `db_query` to match SKUs and `rest_request` batches to save. If stock in the lookup tables disagrees with the product, a WooCommerce tool can rebuild the tables (`wc_tools`, with your approval).
7. **Check the storefront afterwards.** An empty cart redirects checkout to the cart, so the AI app reports checkout as "not tested" rather than placing an order.
   - Example prompt: `Check two changed product pages and the cart, and look for new errors.`
   - Your AI app will use `page_check` and `error_log_read`.
:::

*Example preview on the demo store your-store.com, for "raise by 5 percent, round to .99":*

| Product | Current price | New price |
|---|---|---|
| Cast Iron Skillet | $39.00 | $40.99 |
| Stoneware Mug | $14.00 | $14.99 |
| Tea Towel Set | $18.00 | $18.99 |

Nothing is saved until you say yes.

## Digital or physical store

PowerWP AI looks at what you sell and switches on the check-ups that fit: a digital goods pack, a physical goods pack, or both for a mixed store. You can switch packs on and off under **PowerWP AI › Recipes**. Where a store-type check-up exists, it replaces the general woocommerce_checkup.

See [Digital and physical store check-ups](/docs/reference/recipes/#pack-digital_store) and [physical store check-ups](/docs/reference/recipes/#pack-physical_store) for every recipe.

## Check the result

- For a bulk change, the AI app reads the changed items back and compares price or quantity and stock status with the plan. It reports every item that returned an error.
- It looks at two changed product pages and at the cart.
- **PowerWP AI › Changes** shows the batch. Its summary gives the batch id and the checkpoint id.

## How to undo

- **A single product, variation, coupon or order** changed with `rest_request` is snapshotted and can be rolled back, including its stock.
- **A batch of up to 100 items** is undone in one step with **Roll back this batch** in **Changes** (a change's panel calls it **Roll back the whole batch**), or by asking your AI app to roll back that batch. Changed and deleted items come back, created ones are removed.
- **Batches over 100 items** are not recorded for undo, and the change log says so. That is why your AI app keeps batches at 100 or fewer.
- **Not recorded:** scheduled-action runs and cancellations, WooCommerce tool runs, and e-mails that WooCommerce already sent. A status change that e-mailed a customer cannot take that e-mail back.

## Recipes that do this

Start with your store's check-up from the digital or physical pack. Use [stuck_orders](/docs/reference/recipes/#stuck_orders) on a shipping store, or [failed_orders_review](/docs/reference/recipes/#failed_orders_review) on any store, to sort problem orders by cause. [scheduled_sale](/docs/reference/recipes/#scheduled_sale) sets sale prices with start and end dates, so the sale ends by itself.

:::cards
- [Work safely on a live site](/docs/guides/safe-workflow/) — Checkpoint, preview, small batches.
- [Find what slows your site](/docs/guides/speed/) — Stuck queues and database size.
- [What can't be undone](/docs/safety/limits/) — The list of exceptions.
- [All recipes](/docs/reference/recipes/) — Every ready-made procedure.
:::

Source: https://powerwp.ai/docs/guides/woocommerce/
