younifyd
Menu

orderCancel

Cancels an order, with options for refunding, restocking inventory, and customer notification.

Use it in a workflow

  1. Add a step and choose the Shopify connector.
  2. Pick the orderCancel action (under Order).
  3. Fill in the fields below, then reference the result from later steps as {{ordercancel.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation OrderCancel($orderId: ID!, $refund: Boolean, $refundMethod: OrderCancelRefundMethodInput, $restock: Boolean!, $reason: OrderCancelReason!, $notifyCustomer: Boolean, $staffNote: String) {
  orderCancel(
    orderId: $orderId
    refund: $refund
    refundMethod: $refundMethod
    restock: $restock
    reason: $reason
    notifyCustomer: $notifyCustomer
    staffNote: $staffNote
  ) {
    job {
      done
      id
      query {
        appDiscountTypes
        availableBackupRegions
        availableCarrierServices
        availableLocales
        backupRegion
        businessEntities
        catalogOperations
        collectionConditionMetafieldDefinitions
        collectionRulesConditions
        consentPolicyRegions
        currentAppInstallation
        currentStaffMember
        deliveryPromiseSettings
        financeAppAccessPolicy
        financeKycInformation
        fulfillmentConstraintRules
        giftCardConfiguration
        inventoryProperties
        locationsAvailableForDeliveryProfiles
        metafieldDefinitionTypes
        onlineStore
        pendingOrdersCount
        primaryMarket
        privacySettings
        publicApiVersions
        serverPixel
        shop
        shopBillingPreferences
        shopifyPaymentsAccount
        storeCreditConfiguration
        taxonomy
      }
    }
    orderCancelUserErrors {
      code
      field
      message
    }
    userErrors {
      field
      message
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

orderIdstringrequired

The ID of the order to be canceled.

refundboolean

Indicates whether to refund the amount paid by the customer. Authorized payments will be voided regardless of this setting.

refundMethodobject

Indicates how to refund the amount paid by the customer. Authorized payments will be voided regardless of this setting.

originalPaymentMethodsRefundboolean
storeCreditRefundobject1 fields
restockbooleanrequired

Whether to restock the inventory committed to the order. For unpaid orders fulfilled from locations that have been deactivated, inventory will not be restocked to the deactivated locations even if this argument is set to true.

reasonstringrequired

The reason for canceling the order.

One ofCUSTOMERDECLINEDFRAUDINVENTORYSTAFFOTHER

notifyCustomerboolean

Whether to send a notification to the customer about the order cancellation.

staffNotestring

A staff-facing note about the order cancellation. This is not visible to the customer. Maximum length of 255 characters.

json
{
  "orderId": "string",
  "restock": false,
  "reason": "CUSTOMER",
  "refund": false,
  "refundMethod": {
    "originalPaymentMethodsRefund": false,
    "storeCreditRefund": {
      "expiresAt": "string"
    }
  },
  "notifyCustomer": false,
  "staffNote": "string"
}

Response

Read the result with {{ordercancel.response.data.data.orderCancel}}. If the API returns errors, the step fails and they are at {{ordercancel.response.data.errors}}.

jobobject
doneboolean
idstring
queryobject31 fields
orderCancelUserErrorsarray<object>
codeobject
fieldobject
messageobject
userErrorsarray<object>
fieldobject
messageobject

Need more? See the Shopify guide for connection setup and behaviour shared by every action.

Was this page helpful?