Adobe Commerce only. Learn more.

moveProductsBetweenWishlists mutation

The moveProductsBetweenWishlists mutation moves the specified quantities of one or more products to a different wish list.

If you do not specify a quantity for a product, the mutation moves the entire quantity of that product to the target wish list.

Use the customer query to return a list of wish list IDs and item IDs.

This mutation requires a valid customer authentication token.

Syntax

1
2
3
4
5
6
7
8
9
mutation {
    moveProductsBetweenWishlists(
        sourceWishlistUid: ID!,
        destinationWishlistUid: ID!,
        wishlistItems: [WishlistItemMoveInput!]!
    ) {
        MoveProductsBetweenWishlistsOutput
    }
}

Example usage

The following example moves an item to another wish list. The ID of the moved product changes.

Request:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
mutation{
  moveProductsBetweenWishlists(sourceWishlistUid: 2, destinationWishlistUid: 1, wishlistItems: [
    {
      wishlist_item_id: 9
      quantity: 1
    }
  ]){
    source_wishlist {
      id
      items_v2 {
        items {
          id
          product {
            uid
            sku
            name
          }
        }
      }
    }
    destination_wishlist {
      id
      items_v2 {
        items {
          id
          product {
            uid
            sku
            name
          }
        }
      }
    }
    user_errors {
      code
      message
    }
  }
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{
  "data": {
    "moveProductsBetweenWishlists": {
      "source_wishlist": {
        "id": "2",
        "items_v2": {
          "items": [
            {
              "id": "8",
              "product": {
                "uid": "NDk=",
                "sku": "240-LV08",
                "name": "Advanced Pilates & Yoga (Strength)"
              }
            },
            {
              "id": "10",
              "product": {
                "uid": "MTQ1MA==",
                "sku": "WS04",
                "name": "Layla Tee"
              }
            },
            {
              "id": "11",
              "product": {
                "uid": "MTU2Mg==",
                "sku": "WS12",
                "name": "Radiant Tee"
              }
            },
            {
              "id": "12",
              "product": {
                "uid": "MTYxMA==",
                "sku": "WB01",
                "name": "Electra Bra Top"
              }
            },
            {
              "id": "13",
              "product": {
                "uid": "MTY0Mg==",
                "sku": "WB03",
                "name": "Celeste Sports Bra"
              }
            },
            {
              "id": "15",
              "product": {
                "uid": "MTcyMg==",
                "sku": "WT03",
                "name": "Nora Practice Tank"
              }
            },
            {
              "id": "16",
              "product": {
                "uid": "MTY5MA==",
                "sku": "WT01",
                "name": "Bella Tank"
              }
            }
          ]
        }
      },
      "destination_wishlist": {
        "id": "1",
        "items_v2": {
          "items": [
            {
              "id": "1",
              "product": {
                "uid": "MTM=",
                "sku": "24-WB07",
                "name": "Overnight Duffle"
              }
            },
            {
              "id": "2",
              "product": {
                "uid": "MTA=",
                "sku": "24-WB05",
                "name": "Savvy Shoulder Tote"
              }
            },
            {
              "id": "3",
              "product": {
                "uid": "MTE=",
                "sku": "24-WB06",
                "name": "Endeavor Daytrip Backpack"
              }
            },
            {
              "id": "4",
              "product": {
                "uid": "MTA5OA==",
                "sku": "WH04",
                "name": "Miko Pullover Hoodie"
              }
            },
            {
              "id": "5",
              "product": {
                "uid": "MTIyNg==",
                "sku": "WJ01",
                "name": "Stellar Solar Jacket"
              }
            },
            {
              "id": "6",
              "product": {
                "uid": "MTcyMg==",
                "sku": "WT03",
                "name": "Nora Practice Tank"
              }
            },
            {
              "id": "7",
              "product": {
                "uid": "MTY5MA==",
                "sku": "WT01",
                "name": "Bella Tank"
              }
            },
            {
              "id": "17",
              "product": {
                "uid": "MTg=",
                "sku": "24-UG02",
                "name": "Pursuit Lumaflex™ Tone Band"
              }
            }
          ]
        }
      },
      "user_errors": []
    }
  }
}

Input attributes

The moveProductsBetweenWishlists mutation requires the following input.

Attribute Data Type Description
destinationWishlistUid ID! The ID of the wishlist to move products to
sourceWishlistUid ID! The ID of the origin wishlist
wishlistItems [WishlistItemMoveInput!]! A list of items to be moved

WishlistItemMoveInput attributes

The WishlistItemMoveInput object contains the following attributes.

Attribute Data Type Description
quantity Float The quantity of this item to move to the destination wish list. This value cannot be greater than the quantity in the source wish list
wishlist_item_id ID! The unique ID of the WishlistItemInterface item to be moved

Output attributes

The MoveProductsBetweenWishlistsOutput object can contain the following attributes.

Attribute Data Type Description
destination_wishlist Wishlist! The destination wish list containing the moved products
source_wishlist Wishlist! The wish list that the products were moved from
user_errors [WishListUserInputError!] An array of errors encountered while copying products in a wish list

Wishlist attributes

The Wishlist object contains all the items in the customer’s wish list.

Attribute Data type Description
id ID The unique ID of a Wishlist object
items [WishlistItem] Deprecated. Use items_v2 instead
items_v2 [WishlistItemInterface] An array of items in the customer’s wish list
items_count Int The number of items in the wish list
name String The wish list name. Applicable to Adobe Commerce only
sharing_code String An encrypted code that Magento uses to link to the wish list
updated_at String The time of the last modification to the wish list
visibility WishlistVisibilityEnum! An enum indicating whether the wish list is PUBLIC or PRIVATE. Applicable to Adobe Commerce only

WishlistItem attributes

The WishlistItem object can contain the following attributes.

Attribute Data type Description
added_at String The time when the customer added the item to the wish list
description String The customer’s comment about this item
id Int The wish list item ID
product ProductInterface The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes
qty Float The quantity of this wish list item

WishListUserInputError attributes

The WishListUserInputError object contains information about errors that are specific to wish lists.

Attribute Data Type Description
code WishListUserInputErrorType! A wish list-specific error code. Possible values include PRODUCT_NOT_FOUND and UNDEFINED
message String! A localized error message