clearWishlist mutation

The clearWishlist mutation removes all items from a wishlist for the logged in customer.

This mutation requires a valid customer authentication token.

data-variant=info
data-slots=text1
This mutation is part of the Storefront Compatibility Package. It will be added to Adobe Commerce 2.4.9.

Syntax

mutation {
  clearWishlist(wishlistId: int) {
      user_errors {
          code
          message
      }
      wishlist {
          id
          items_count
          name
          sharing_code
          updated_at
          visibility
      }
  }
}

Example usage

The following example clears the wishlist with ID 15 for the customer.

Request:

mutation {
  clearWishlist(wishlistId: 15) {
    user_errors {
        code
        message
    }
    wishlist {
        id
        items_count
        name
        sharing_code
        updated_at
        visibility
    }
}

Response:

{
  "data": {
    "clearWishlist": {
      "user_errors": [],
      "wishlist": {
        "id": "15",
        "items_count": 0,
        "name": "Wish List",
        "sharing_code": "l6jgZ3VJxNeJguCJpbFTMMagkr5TKaep",
        "updated_at": "2025-05-27 07:26:09",
        "visibility": "PRIVATE"
      }
    }
  }
}