---
title: "addItem(withProductID:completionHandler:)"
framework: mediaplayer
role: symbol
role_heading: Instance Method
path: "mediaplayer/mpmediaplaylist/additem(withproductid:completionhandler:)"
---

# addItem(withProductID:completionHandler:)

Adds the item associated with the product identifier to the end of the playlist.

## Declaration

```swift
func addItem(withProductID productID: String, completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

```swift
func addItem(withProductID productID: String) async throws
```

## Parameters

- `productID`: The product identifier for the item to add.
- `completionHandler`: A block that the system calls after it adds the item to the playlist.

## Discussion

Discussion The method adds a single media item associated with the product identifier to the playlist.

## See Also

### Adding media items to a playlist

- [add(_:completionHandler:)](mediaplayer/mpmediaplaylist/add(_:completionhandler:).md)
