# Hooks (/themes/sdk/reference/price/hooks)

```ts
import { … } from '@poltura/theme-sdk/price';
```

## `usePrice` [#useprice]

The amounts behind a price, for code that must compute with them.

```ts
usePrice(price: PriceView | null): ResolvedPrice | null
```

**Parameters**

- `price: PriceView | null`: The price of a product, variant or card.

**Returns:** The resolved amounts, or null on pages with live prices (`islands`) and for hidden prices.

**Example**

```tsx
import { usePrice } from '@poltura/theme-sdk/price';
import type { PriceView } from '@poltura/theme-sdk/price';

export function OnSale({ price }: { price: PriceView }) {
  const resolved = usePrice(price);
  return resolved?.compareAt ? <span>Sale</span> : null;
}
```

## `usePriceAccess` [#usepriceaccess]

Whether the visitor may see prices, on which tax basis, and what unlocks them when hidden.

```ts
usePriceAccess(): PriceAccess
```

**Returns:** The visitor's price access.

**Example**

```tsx
import type { ReactNode } from 'react';
import { PriceGate, usePriceAccess } from '@poltura/theme-sdk/price';

export function PricesOrGate({ children }: { children: ReactNode }) {
  const access = usePriceAccess();
  return access.visible ? <>{children}</> : <PriceGate />;
}
```
