Connectors

/

WooCommerce

/

Update WooCommerce stock and prices by SKU
Write

Change WooCommerce stock and prices on exactly the right SKU

For store teams who want stock, regular price or sale price updated by SKU by asking their AI assistant.

Try PopdockAI free
Get a live demo
Update WooCommerce stock and prices by SKU
Set stock for MUG-BLU to 60 and put it on sale at 9.99 in WooCommerce.
MUG-BLU is the Blue mug variation, and both changes are valid. - Stock: 18 to 60 - Sale price: none to 9.99 - Regular price: 12.00, unchanged Shall I update the variation?
WooCommerce
Sample figures. Your results come from your own account.
woocommerce-get-product
woocommerce-get-product-variation
woocommerce-update-product
woocommerce-update-product-variation

On this page

The problem

The problem

The prompt

Who it's for

How it works

Tools used

Connector

WooCommerce

WooCommerce
Run it on your own WooCommerce data.

Connect WooCommerce, pick your AI tool and paste the prompt.

Try PopdockAI free

The problem

Updating the wrong record behind a SKU

Changing stock or prices in WooCommerce by SKU means working out whether it is a simple product, a variation or a variable parent with no price of its own. Update the wrong record and the storefront shows the wrong price or stock.

Without PopdockAI

  • Search the catalog for the SKU
  • Work out whether it is a product or variation
  • Edit stock and prices by hand
  • Update the parent instead of the variation

With PopdockAI

  • The item is found, listing variations if the SKU is a parent
  • Stock and prices are validated
  • It asks before turning on stock tracking
  • The right record is updated once after you confirm and read back

The prompt

Use this prompt

Copy it into any AI tool connected to PopdockAI. Swap the values in braces for your own.

Prompt
**Objective:** For the item with SKU `{sku}`, set the stock quantity to `{stock-quantity}`, the regular price to `{regular-price}` and the sale price to `{sale-price}`. Change only the values that are given.

**Step 1: Find the item**

1. Call `woocommerce-get-product` with `sku` = `{sku}`.
2. If nothing matches, call `woocommerce-get-product-variation` with `sku` = `{sku}`. A match is a variation: keep `product-variation-id` and its parent `product-id`.
3. If a product matches and its `type` is `variable`, the SKU belongs to the parent, which has no price of its own. Call `woocommerce-get-product-variation` with `product-id`, list the variations with their SKUs, and stop so the user can choose one.
4. If nothing matches either read, say so and stop.

Keep the current `regular-price`, `sale-price`, `stock-quantity` and `stock-status`.

**Step 2: Check the changes**

* If `{stock-quantity}`, `{regular-price}` and `{sale-price}` are all empty, ask what to change and stop.
* Stock must be a whole number of 0 or more. If the item's `stock-quantity` is currently empty, stock is not tracked: ask whether to turn tracking on, and only then pass `manage-stock` true.
* Prices must be numbers above 0. The sale price must be below the regular price that will apply after the change.

**Step 3: Confirm**

Show a before and after table for each value that changes, and say which tool will write. Wait for an explicit yes.

**Step 4: Update**

* A simple product: call `woocommerce-update-product` once with `product-id` and only the changed values.
* A variation: call `woocommerce-update-product-variation` once with `variation-id` = the `product-variation-id`, `product-id` = the parent id, and only the changed values.

**Step 5: Verify and report**

Re-read the item with the same read tool used in Step 1, filtered by `sku`, and report the values before and after, including `stock-status` (setting stock above 0 on a tracked item moves it back to `instock`).

**Rules & Guidelines:**

* The only write tools this prompt may call are `woocommerce-update-product` or `woocommerce-update-product-variation`, once, never both.
* Do not call any other write tool (`woocommerce-add-order`, `woocommerce-update-order`, `woocommerce-add-order-note`, `woocommerce-send-order-details`, `woocommerce-add-refund`, `woocommerce-add-customer`, `woocommerce-update-customer`, `woocommerce-add-product`, `woocommerce-add-coupon`, `woocommerce-update-coupon`).
* Never pass `name`, `description`, `status` or `sku`; this prompt changes stock and prices only.

**Validation:**

* If the user's confirmation is anything other than a clear yes, stop without writing.
* If the update fails, report the error and stop.

Who it's for

One answer, three teams that use it

Inventory managers

Set stock after a delivery

Update stock for a SKU in one message, on the exact variation that changed.

Set stock for TEE-BLK-L to 120 in WooCommerce.

Ecommerce managers

Put one item on sale

Set a sale price that is checked against the regular price before it goes live.

Put LAMP-110 on sale at 34.99 in WooCommerce.

Pricing managers

Change a regular price safely

Prices are validated above zero, and the record is read back after the update.

Change the regular price of KETTLE-05 to 49.00 in WooCommerce.

How it works

What PopdockAI does when you ask

You give a SKU and the new values, and your AI assistant finds the right record and checks them. You approve a before and after table, then only the changed values are written.

01

Ask

You give a SKU and any new stock, regular price or sale price.

Your AI tool

02

Find

It finds the item, listing variations if the SKU is a variable parent.

woocommerce-get-product
woocommerce-get-product-variation

03

Check

It validates stock and prices and asks before turning on stock tracking.

No items found.

04

Confirm

You approve the before and after, then it updates once and reads back.

Your AI tool

What PopdockAI provides

The tools behind the answer

Ready made tools for WooCommerce and one secure connection to your AI tool. No code, no exports.

get-data

woocommerce-get-product

Returns WooCommerce products with prices, stock, status, categories, total sales and average rating. Filter by SKU, name, category, type, status, stock status, price range or a low stock threshold.
get-data

woocommerce-get-product-variation

Returns the variations of WooCommerce variable products with SKU, prices, sale flag and stock. Filter by parent product, SKU, status, stock status, price range, on sale or a low stock threshold.
run-action

woocommerce-update-product

Updates an existing WooCommerce product by id: name, description, SKU, prices, stock quantity, stock status and publishing status. For a variation use Update WooCommerce product variation.
run-action

woocommerce-update-product-variation

Updates one variation of a WooCommerce variable product by id: SKU, prices, stock quantity, stock status and publishing status.
Read only.Nothing in WooCommerce Changes

This report is built from Get data tools only. PopdockAI applies the row, field and parameter rules your admin sets, and every query is written to the audit trail.

How Popdock AI secures your data

The outcome

Changes on exactly the right product or variation

Try PopdockAI free
Get a live demo

Related use cases

More ways to put this data to work

All Ramp use cases

One prompt template with infinite possibilities.

‍

Your AI assistant adapts its approach, tone, and capabilities to match each unique context while you maintain a single, manageable workflow.

Join forward-thinking companies that are transforming their operations with intelligent, secure AI automation.

Try PopdockAI Free
See Documentation