Adobe Commerce only. Learn more.

copyProductsBetweenWishlists mutation

The copyProductsBetweenWishlists mutation copies the specified quantities of one or more products to a different wish list. The original wish list is unchanged.

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 {
  copyProductsBetweenWishlists(
    sourceWishlistUid: ID!,
    destinationWishlistUid: ID!,
    wishlistItems: [WishlistItemCopyInput!]!
  ){
    CopyProductsBetweenWishlistsOutput
  }
}

Example usage

The following example copies two items to another wish list.

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
mutation{
  copyProductsBetweenWishlists(sourceWishlistUid: 1, destinationWishlistUid: 2, wishlistItems: [
    {
      wishlist_item_id: 6
      quantity: 1
    }
    {
      wishlist_item_id: 7
      quantity: 1
    }
  ]){
    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
{
  "data": {
    "copyProductsBetweenWishlists": {
      "destination_wishlist": {
        "id": "2",
        "items_v2": {
          "items": [
            {
              "id": "8",
              "product": {
                "uid": "NDk=",
                "sku": "240-LV08",
                "name": "Advanced Pilates & Yoga (Strength)"
              }
            },
            {
              "id": "9",
              "product": {
                "uid": "MTg=",
                "sku": "24-UG02",
                "name": "Pursuit Lumaflex™ Tone Band"
              }
            },
            {
              "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"
              }
            }
          ]
        }
      },
      "user_errors": []
    }
  }
}

Input attributes

The copyProductsBetweenWishlists mutation requires the following input.

Attribute Data Type Description
destinationWishlistUid ID! The ID of the wishlist to copy products to
sourceWishlistUid ID! The ID of the origin wishlist
wishlistItems [WishlistItemCopyInput!]! A list of items to be copied

WishlistItemCopyInput attributes

The WishlistItemCopyInput 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 object to be copied

Output attributes

The CopyProductsBetweenWishlistsOutput object can contain the following attributes.

Attribute Data Type Description
destination_wishlist Wishlist! The destination wish list containing the copied products
source_wishlist Wishlist! The wish list that the products were copied from
user_errors [WishListUserInputError!] An array of errors encountered while copying products to 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