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

# .getCached()

> Get the cached customer object synchronously

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

Returns the customer object currently held in memory without making a network request. Populated by [`customer.init()`](/api/customer/init), [`login()`](/api/customer/login), [`register()`](/api/customer/register), [`get()`](/api/customer/get), and [`update()`](/api/customer/update).

## Returns

`ShopifyCustomer | null` — the cached customer, or `null` if no customer is logged in.

See [ShopifyCustomer](/api/types/customer#shopifycustomer) for the full shape.

## Examples

### Synchronous access for SSR-style rendering

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

if (customer) {
    document.querySelector('#greeting').textContent = `Hello, ${customer.firstName}`
}
```

### Avoiding a redundant network call

```javascript theme={null}
function getCustomerEmail() {
    return openbridge.customer.getCached()?.email ?? null
}
```

<Info>
  The cache is populated when the SDK initializes a logged-in session. For the freshest data from Shopify, use [`customer.get()`](/api/customer/get) instead.
</Info>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.