> ## 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.

# .get()

> Get the current customer profile

```javascript theme={null}
openbridge.customer.get()
```

Fetches the current customer's profile data from Shopify. Requires the customer to be logged in.

## Returns

`Promise<ShopifyCustomer>` - The customer object with profile data.

## Throws

* `Error` - If not logged in or token is invalid.

## Examples

### Get customer profile

```javascript theme={null}
try {
    const customer = await openbridge.customer.get()

    console.log(customer.email)
    console.log(customer.firstName, customer.lastName)
    console.log(`Total orders: ${customer.numberOfOrders}`)
} catch (error) {
    console.error('Not logged in')
}
```

### Display account info

```javascript theme={null}
async function loadAccountPage() {
    const customer = await openbridge.customer.get()

    document.querySelector('#name').textContent = customer.displayName
    document.querySelector('#email').textContent = customer.email
    document.querySelector('#phone').textContent = customer.phone || 'Not set'

    if (customer.defaultAddress) {
        document.querySelector('#address').textContent =
            customer.defaultAddress.formatted.join(', ')
    }
}
```

### Sync vs Async access

```javascript theme={null}
// Async - fetches fresh data from Shopify
const customer = await openbridge.customer.get()

// Sync - returns cached data (may be stale)
const cachedCustomer = openbridge.customer.getCached()

// Check login state without API call
const isLoggedIn = openbridge.customer.isLoggedIn()
```

## Related Methods

| Method          | Description                            |
| --------------- | -------------------------------------- |
| `.getCached()`  | Get cached customer data synchronously |
| `.isLoggedIn()` | Check if customer is logged in (sync)  |
| `.getToken()`   | Get the raw access token               |
