> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openbridge.shop/llms.txt
> Use this file to discover all available pages before exploring further.

# .after()

> Paginate forward

```javascript theme={null}
openbridge.products.list().after(cursor)
```

Sets the cursor for forward pagination. Use to fetch the next page.

## Parameters

| Param    | Type     | Required | Description                                 |
| -------- | -------- | -------- | ------------------------------------------- |
| `cursor` | `string` | Yes      | `pageInfo.endCursor` from previous response |

## Returns

`ProductListBuilder` (chainable)

## Examples

### Basic pagination

```javascript theme={null}
// First page
const page1 = await openbridge.products.list().limit(12)

// Next page
if (page1.pageInfo.hasNextPage && page1.pageInfo.endCursor) {
    const page2 = await openbridge.products
        .list()
        .limit(12)
        .after(page1.pageInfo.endCursor)
}
```

### Paginate collection

```javascript theme={null}
const page1 = await openbridge.products.list().collection('all').limit(12)

if (page1.pageInfo.hasNextPage && page1.pageInfo.endCursor) {
    const page2 = await openbridge.products
        .list()
        .collection('all')
        .limit(12)
        .after(page1.pageInfo.endCursor)
}
```

### Load all products

```javascript theme={null}
async function loadAll() {
    const all = []
    let cursor = null
    let hasMore = true

    while (hasMore) {
        let query = openbridge.products.list().limit(100)
        if (cursor) query = query.after(cursor)

        const { items, pageInfo } = await query

        all.push(...items)
        hasMore = pageInfo.hasNextPage
        cursor = pageInfo.endCursor
    }

    return all
}
```
