---
title: metafieldsDelete - Customer API
description: Deletes multiple metafields in bulk.
api_version: 2026-10
source_url:
  html: 'https://shopify.dev/docs/api/customer/latest/mutations/metafieldsDelete'
  md: 'https://shopify.dev/docs/api/customer/latest/mutations/metafieldsDelete.md'
api_name: customer
api_type: graphql
type: mutation
---

# metafieldsDelete

mutation

Requires access defined by each metafield input `ownerId` scalar's type in a `MetafieldIdentifierInput` field. For example, setting a metafield on a `CUSTOMER` requires the same access as mutating a `CUSTOMER`.

Deletes multiple metafields in bulk.

## Arguments

* metafields

  [\[MetafieldIdentifierInput!\]!](https://shopify.dev/docs/api/customer/latest/input-objects/MetafieldIdentifierInput)

  required

  A list of identifiers specifying metafields to delete. At least one identifier must be specified.

***

## MetafieldsDeletePayload returns

* deletedMetafields

  [\[MetafieldIdentifier\]](https://shopify.dev/docs/api/customer/latest/objects/MetafieldIdentifier)

  List of metafield identifiers that were deleted, null if the corresponding metafield isn't found.

* userErrors

  [\[MetafieldsDeleteUserError!\]!](https://shopify.dev/docs/api/customer/latest/objects/MetafieldsDeleteUserError)

  non-null

  The list of errors that occurred from executing the mutation.

***

## Examples

* ### Delete metafields

  #### Description

  Delete several metafields in one call. Each metafield is identified by its \`ownerId\`, \`namespace\` and \`key\`. The customer can only delete metafields whose definition grants customer account write access. \`deletedMetafields\` returns the identifier of each deleted metafield, in the order of the input, or \`null\` for a metafield that wasn't found. The mutation is atomic: if any input fails, then no metafields are deleted and \`userErrors\` lists the failures.

  #### Query

  ```graphql
  mutation MetafieldsDelete($metafields: [MetafieldIdentifierInput!]!) {
    metafieldsDelete(metafields: $metafields) {
      deletedMetafields {
        key
        namespace
        ownerId
      }
      userErrors {
        field
        message
        code
        elementIndex
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "metafields": [
      {
        "key": "customer-metafield",
        "namespace": "app--5677769--namespace",
        "ownerId": "gid://shopify/Customer/624407574"
      },
      {
        "key": "customer-metafield-2",
        "namespace": "app--5677769--namespace",
        "ownerId": "gid://shopify/Customer/624407574"
      }
    ]
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/customer/api/2026-10/graphql \
  -H 'Content-Type: application/json' \
  -H 'Authorization: {access_token}' \
  -d '{
  "query": "mutation MetafieldsDelete($metafields: [MetafieldIdentifierInput!]!) { metafieldsDelete(metafields: $metafields) { deletedMetafields { key namespace ownerId } userErrors { field message code elementIndex } } }",
   "variables": {
      "metafields": [
        {
          "key": "customer-metafield",
          "namespace": "app--5677769--namespace",
          "ownerId": "gid://shopify/Customer/624407574"
        },
        {
          "key": "customer-metafield-2",
          "namespace": "app--5677769--namespace",
          "ownerId": "gid://shopify/Customer/624407574"
        }
      ]
    }
  }'
  ```

  #### Response

  ```json
  {
    "metafieldsDelete": {
      "deletedMetafields": [
        {
          "key": "customer-metafield",
          "namespace": "app--5677769--namespace",
          "ownerId": "gid://shopify/Customer/624407574"
        },
        {
          "key": "customer-metafield-2",
          "namespace": "app--5677769--namespace",
          "ownerId": "gid://shopify/Customer/624407574"
        }
      ],
      "userErrors": []
    }
  }
  ```

* ### Delete metafields when one doesn't exist

  #### Description

  Each metafield is identified by its \`ownerId\`, \`namespace\` and \`key\`, and the customer can only delete metafields whose definition grants customer account write access. When the customer has no value for one of the identified metafields, \`deletedMetafields\` returns \`null\` in that position and \`userErrors\` stays empty. The other metafields are still deleted. No metafields are deleted if any input fails, for example because the customer can't write to it.

  #### Query

  ```graphql
  mutation MetafieldsDelete($metafields: [MetafieldIdentifierInput!]!) {
    metafieldsDelete(metafields: $metafields) {
      deletedMetafields {
        key
        namespace
        ownerId
      }
      userErrors {
        field
        message
        code
        elementIndex
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "metafields": [
      {
        "key": "customer-metafield",
        "namespace": "app--5677769--namespace",
        "ownerId": "gid://shopify/Customer/624407574"
      },
      {
        "key": "customer-metafield-2",
        "namespace": "app--5677769--namespace",
        "ownerId": "gid://shopify/Customer/624407574"
      }
    ]
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/customer/api/2026-10/graphql \
  -H 'Content-Type: application/json' \
  -H 'Authorization: {access_token}' \
  -d '{
  "query": "mutation MetafieldsDelete($metafields: [MetafieldIdentifierInput!]!) { metafieldsDelete(metafields: $metafields) { deletedMetafields { key namespace ownerId } userErrors { field message code elementIndex } } }",
   "variables": {
      "metafields": [
        {
          "key": "customer-metafield",
          "namespace": "app--5677769--namespace",
          "ownerId": "gid://shopify/Customer/624407574"
        },
        {
          "key": "customer-metafield-2",
          "namespace": "app--5677769--namespace",
          "ownerId": "gid://shopify/Customer/624407574"
        }
      ]
    }
  }'
  ```

  #### Response

  ```json
  {
    "metafieldsDelete": {
      "deletedMetafields": [
        {
          "key": "customer-metafield",
          "namespace": "app--5677769--namespace",
          "ownerId": "gid://shopify/Customer/624407574"
        },
        null
      ],
      "userErrors": []
    }
  }
  ```

* ### metafieldsDelete reference
