> ## Documentation Index
> Fetch the complete documentation index at: https://www.voiceflow.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Change or cancel an order

> Help a customer correct an address or cancel a permitted order using Shopify. Check the merchant’s policy and the current order, then execute only the action the…

Help a customer correct an address or cancel a permitted order using Shopify. Check the merchant’s policy and the current order, then execute only the action the customer explicitly confirms.

For other stores, [WooCommerce](/docs/guides/integrations/woocommerce/overview#updating-orders) and [Wix Stores](/docs/guides/integrations/wix-stores/overview#updating-orders) document their own confirmed address/cancellation paths and effects. A [Squarespace order read](/docs/guides/integrations/squarespace-commerce/overview#looking-up-orders) supports merchant review; it is not an address-change or refund action.

## Before you begin

- A dedicated test project and a [verified Shopify connection](/docs/documentation/build/tools/shopify#connecting-shopify) for connector examples. Use your actual store values instead of the fictional Northstar examples.
- An application-owned customer/order access check for personal data or changes. Search values and tool Triggers are not authorization.
- A merchant-approved test order and an authorized customer-to-order association.
- For an address update, the complete confirmed new address and any existing fields you must preserve. The order lookup does not return a complete shipping address.
- For cancellation, explicit confirmation of the order, refund request and restock choice. The connector sends `refund: true`.

#### Studio

Open the test project in [Agent studio](https://creator.voiceflow.com).

#### Developer

Use a [Voiceflow bearer credential](/docs/api-reference/authentication) with access to your test project and Environment. Keep it on your backend or development machine. Set:

```sh
export VF_TOKEN='YOUR_VOICEFLOW_BEARER_TOKEN'
export PROJECT_ID='YOUR_TEST_PROJECT_ID'
export ENVIRONMENT='main'
```

Use a current [Voiceflow CLI](/docs/cli/install) if you choose CLI. API and CLI examples use the Environment's saved Draft. Standalone execution does not attach a tool, compile an agent or publish a release.

## Confirm the requested change

### 1. Read and authorize the current order

Complete [Check an order](/docs/guides/integrations/commerce/check-an-order) and verify the returned ID against your application mapping. Keep the authorized lookup values application-owned through execution; a model-written Trigger cannot enforce customer access.

### 2. Confirm the exact action

Repeat the exact action to the customer:

- **Address change:** confirm all supplied address fields.
- **Cancellation:** state the order, refund request and restock choice.

Recheck merchant policy and fulfillment constraints. Continue on a separate confirmed path; send ambiguous requests to support.

## Change the address or note

The current action requires `shippingAddress`, including for a note-only change. Supply the complete verified existing address when preserving it; Get order’s display address is incomplete. A supplied `note` replaces its prior contents.

### 1. Apply the confirmed update

#### Studio

Place **Shopify → Update order** on the confirmed-change Workflow path. Set the verified lookup values, complete `shippingAddress` and optional replacement `note`. Run once with the test order.

Supply the complete confirmed change on the authorized order path. — Supply the complete confirmed change on the authorized order path.

#### Developer

#### API

```sh
curl --fail-with-body --silent --show-error \
  --request POST "https://realtime-api.voiceflow.com/v1/stable/integration/shopify/execute?projectID=$PROJECT_ID&environmentAlias=$ENVIRONMENT" \
  --header "Authorization: Bearer $VF_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "toolName": "shopify_update_order",
  "inputs": {
    "email": "maya@northstar.example",
    "orderNumber": "NS-1042",
    "shippingAddress": {
      "address1": "123 Example Street",
      "city": "Toronto",
      "provinceCode": "ON",
      "countryCode": "CA",
      "zip": "M5V 2T6",
      "firstName": "Maya",
      "lastName": "Chen"
    }
  }
}'
```

#### CLI

```sh
vf integration execute --output-format json --integration shopify \
  --project-id "$PROJECT_ID" --environment-alias "$ENVIRONMENT" \
  --tool-name shopify_update_order \
  --inputs '{
  "email": "maya@northstar.example",
  "orderNumber": "NS-1042",
  "shippingAddress": {
    "address1": "123 Example Street",
    "city": "Toronto",
    "provinceCode": "ON",
    "countryCode": "CA",
    "zip": "M5V 2T6",
    "firstName": "Maya",
    "lastName": "Chen"
  }
}'
```

Require `success: true`, `error: null` and `truncated: false` before using `output.data`. An HTTP 200 alone does not establish a successful action.

### 2. Verify the saved fields

Require an empty `orderUpdate.userErrors` and the expected `orderUpdate.order.id` within the returned data. Check the full address and note in Shopify; the returned display address omits street fields.

An order update does not establish that an existing shipment was rerouted.

## Cancel the confirmed order

This action sends **`refund: true`** and reason `CUSTOMER`; `restock` defaults to `true`. Confirm these effects with the customer before execution.

### 1. Run the confirmed cancellation once

#### Studio

Configure **Shopify → Cancel order** on the confirmed cancellation path. Set the authorized order lookup and explicit restock choice. Run it once, then inspect its job and read the order again.

Set the restock choice before the confirmed cancellation. — Set the restock choice before the confirmed cancellation.

#### Developer

#### API

```sh
curl --fail-with-body --silent --show-error \
  --request POST "https://realtime-api.voiceflow.com/v1/stable/integration/shopify/execute?projectID=$PROJECT_ID&environmentAlias=$ENVIRONMENT" \
  --header "Authorization: Bearer $VF_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "toolName": "shopify_cancel_order",
  "inputs": {
    "email": "maya@northstar.example",
    "orderNumber": "NS-1042",
    "restock": true
  }
}'
```

#### CLI

```sh
vf integration execute --output-format json --integration shopify \
  --project-id "$PROJECT_ID" --environment-alias "$ENVIRONMENT" \
  --tool-name shopify_cancel_order \
  --inputs '{
  "email": "maya@northstar.example",
  "orderNumber": "NS-1042",
  "restock": true
}'
```

Require `success: true`, `error: null` and `truncated: false` before using `output.data`. An HTTP 200 alone does not establish a successful action.

### 2. Inspect the cancellation outcome

| Result | Next action |
| --- | --- |
| `done: true` or `status: "complete"` with `job.done: true` | Read the order and verify `cancelledAt`; check the refund separately in Shopify. |
| `status: "timeout"` | Outcome unknown. Inspect the order and payment state before considering another call. |
| Provider error | Keep the verified order state and route the case for review. |

The action has no caller-supplied idempotency key. A completed job is not proof that funds reached the customer.

## Verify and tell the customer

- **Address/note update:** confirm the intended fields persisted before reporting success.
- **Cancellation:** verify the order state and separate refund outcome before reporting funds returned.
- **Rejected update or business error:** explain that the change was not confirmed and offer support.
- **Unknown cancellation outcome:** preserve the uncertainty and investigate before retrying.

Test each case with your dedicated test records. Keep the customer response tied to the state you verified.

[Shopify's manual](/docs/documentation/build/tools/shopify#updating-orders) owns the detailed input contract. For return assessment rather than order cancellation, use [Assess a return request](/docs/guides/integrations/commerce/assess-a-return-request).
