Connectors

/

WooCommerce

/

Update a WooCommerce coupon by code
Write

Edit a WooCommerce coupon without disabling it by accident

For store and marketing teams who want a WooCommerce coupon changed safely by code by asking their AI assistant.

Try PopdockAI free
Get a live demo
Update a WooCommerce coupon by code
Extend the WooCommerce coupon SPRING20 to 31 December and raise its usage limit to 500.
SPRING20 has been used 212 times, so both changes are valid. - Expiry: 30 November to 31 December 2026 - Usage limit: 300 to 500 - Unchanged: 20 percent off, one use per customer Shall I update the coupon?
WooCommerce
Sample figures. Your results come from your own account.
woocommerce-get-coupon
woocommerce-update-coupon

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

A coupon edit that kills the code by accident

Editing a WooCommerce coupon means finding it by code and making sure the change is valid. A usage limit below the times already used kills the coupon at once, and a new code breaks every email that carries the old one.

Without PopdockAI

  • Search the coupon list for the code
  • Edit limits and expiry by hand
  • Set a limit below times used by mistake
  • Rename it and break live emails

With PopdockAI

  • The coupon is found, with close matches listed if needed
  • Amounts, expiry and usage limits are validated
  • A new code is checked as free, with a warning about broken links
  • It updates once after you confirm, and never creates a coupon

The prompt

Use this prompt

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

Prompt
**Objective:** Apply the change `{changes}` to the coupon with code `{coupon-code}`.

**Step 1: Find the coupon**

Call `woocommerce-get-coupon` with `code` = `{coupon-code}`. If nothing matches, call it again with `code.contains` and list the close matches, then stop. Keep `coupon-id` and every current value.

**Step 2: Work out the change**

Map `{changes}` to the fields `woocommerce-update-coupon` accepts: `code`, `amount`, `discount-type`, `expiry-date`, `usage-limit`, `description`. If the change asks for anything else (minimum amount, usage limit per user, individual use, product restrictions), say that this tool cannot change it and stop.

Check:

* `percent` amounts must be above 0 and at most 100; other amounts above 0.
* `expiry-date` must be an ISO date in the future.
* `usage-limit` must be at least the current `times-used`, or the coupon stops working at once. Say so if it would.
* A new `code` must not exist: check with `woocommerce-get-coupon` (`code`).

**Step 3: Confirm**

Show a before and after table for the changed fields only, plus `times-used`. Wait for an explicit yes.

**Step 4: Update and verify**

Call `woocommerce-update-coupon` once with `coupon-id` and only the changed fields. Then call `woocommerce-get-coupon` with the (possibly new) `code` and report the stored values.

**Rules & Guidelines:**

* The only write tool this prompt may call is `woocommerce-update-coupon`, once.
* 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-update-product`, `woocommerce-update-product-variation`, `woocommerce-add-coupon`). Never create a new coupon when the code is not found.
* Changing the code breaks any link or email that already carries the old one. Say so when the code changes.

**Validation:**

* If `{changes}` is empty or unclear, ask what to change and stop.
* If the user's confirmation is anything other than a clear yes, stop without writing.

Who it's for

One answer, three teams that use it

Ecommerce marketers

Extend a promotion safely

Push out an expiry or raise a limit, with the change checked before it goes live.

Extend coupon SUMMER15 to 15 September and raise the usage limit to 1000.

Store managers

Fix a coupon mistake

Correct an amount or discount type and see the before and after first.

Change coupon WELCOME10 to a 10 percent discount instead of a fixed amount.

Customer service agents

Check a coupon before changing it

Limits below times used are caught, so you do not disable a code customers are using.

Set the usage limit on coupon VIP25 to 50. How many times has it been used?

How it works

What PopdockAI does when you ask

You give the code and the change, and your AI assistant checks it is valid before anything happens. You approve a before and after table, then only the changed fields are updated.

01

Ask

You give the coupon code and the change you want.

Your AI tool

02

Find

It finds the coupon, listing close matches if the code is not exact.

woocommerce-get-coupon

03

Check

It validates amounts, expiry, usage limits and any new code.

woocommerce-get-coupon

04

Confirm

You approve the before and after table, then it updates 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-coupon

Returns WooCommerce coupons with discount type, amount, usage limits, times used and expiry. Filter by code, discount type, times used, created date and expiry date ranges.
run-action

woocommerce-update-coupon

Updates an existing WooCommerce coupon by id: code, discount type, amount, expiry date, usage limit and description.
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

Coupon changes that go live correctly

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