# How to Cancel Shopify Orders With a ZazzyAgent AI Agent

Order cancellation is a powerful ecommerce action.

A customer can ask:

> Please cancel my order.

Instead of automatically cancelling an order based on a vague message, your AI Agent should first identify the correct order and confirm that the customer genuinely wants it cancelled.

ZazzyAgent can be configured to use Shopify order lookup and cancellation actions as part of an AI-powered support workflow.

## What you need

Prepare:

*   Connected Shopify store
    
*   AI Agent
    
*   Shopify order lookup action
    
*   Shopify cancellation action
    
*   Clear cancellation rules
    

## Step 1: Select your Shopify store

Shopify actions require the store to be selected first.

Use:

```text
##shopify_store## : 12
```

Select your actual connected store using the `##` autocomplete.

## Step 2: Add order lookup

Use:

```text
##shopify_get_order_details##
```

The agent can use this to retrieve live order information.

## Step 3: Add the cancellation action

Use:

```text
##shopify_cancel_order##
```

This gives the agent the ability to cancel an order when your workflow allows it.

## Don't cancel based on vague language

This is a bad instruction:

> If the customer mentions cancellation, cancel the order.

A customer could say:

> What's your cancellation policy?

That does not mean they want their order cancelled.

A safer instruction is:

> Cancel only when the customer clearly requests cancellation of a specific existing order.

## Ask for the order number

If the customer says:

> Cancel my order.

but no order number is known, ask:

> Sure. What's your order number?

Then use the order lookup action.

## Confirm the customer's request

For high-impact actions, confirmation can make the workflow safer.

Example:

> I found order #12345. Would you like me to cancel this order?

Customer:

> Yes.

Now the agent can proceed according to your cancellation rules.

## Example System Prompt

```text
You are the Order Support Agent for our Shopify store.

Help customers with existing orders.

When the customer asks about an order,
ask for the order number if it is not already known.

Use the Shopify order lookup action.

##shopify_get_order_details##

When the customer clearly requests cancellation
of the identified order, confirm the cancellation request
before cancelling when confirmation is required by our process.

After the customer's cancellation request is clear,
use the Shopify cancellation action.

##shopify_cancel_order##

Never cancel an order based on an unclear statement.

Never cancel an order simply because the customer asks about
our cancellation policy.

Do not claim that an order has been cancelled unless the
cancellation action succeeds.

If cancellation cannot be completed,
explain the situation and offer human support.
```

## What if the order cannot be cancelled?

The action may not succeed in every situation.

Your agent should not promise:

> Your order has been cancelled.

unless the actual action confirms the result.

Instead:

> I wasn't able to complete the cancellation automatically. I'll connect you with our support team.

## Add human handoff

For cases requiring manual review:

```text
If the cancellation cannot be completed automatically,
assign the conversation to the Support team.

##assign_human_role## : 3
```

## Common cancellation scenarios

### Customer asks about the policy

> Can I cancel an order?

Answer the policy question.

Don't cancel anything.

### Customer asks to cancel

> I want to cancel order #12345.

Look up the order.

Then follow the cancellation rules.

### Customer changes their mind

> Actually, don't cancel it.

The agent should stop the cancellation workflow if the cancellation action hasn't already been executed.

## Don't combine cancellation with guesswork

Never use:

> The customer sounds unhappy, so cancel the order.

An unhappy customer isn't necessarily asking for cancellation.

The action should only happen when the customer's request is clear.

## Add an internal note if useful

You can record context:

```text
##add_note## : Customer requested cancellation of order #12345.
```

See [How AI Agents Add Internal Notes in ZazzyAgent](https://blog.zazzyagent.com/ai-agent-add-internal-notes-zazzyagent).

## Complete workflow

```text
Customer requests cancellation
          ↓
Identify order
          ↓
Shopify order lookup
          ↓
Confirm request if required
          ↓
Cancellation allowed?
      ↓           ↓
     Yes          No
      ↓            ↓
Cancel order     Human support
      ↓
Confirm actual result
      ↓
Customer
```

## Best practice

Order cancellation is an action that changes real business data.

Give your agent a clear rule:

**Identify → Verify → Cancel → Confirm result**

Don't let the AI skip those steps.
