# routes/joy-products

> Source: https://devdocs.joy.so/joy-headless-api/sdk-reference/hydrogen/routes/joy-products/ · Last updated: 2026-11-25

## Interfaces

### JoyAjaxProduct

A product in the shape of Shopify's `/products/{handle}.js` — **integer
cents**, flat image URLs. See `toAjaxProduct` for why this shape and not the
raw GraphQL one.

#### Properties

##### compare_at_price

```ts
compare_at_price: number | null;
```

##### featured_image

```ts
featured_image: string;
```

##### handle

```ts
handle: string;
```

##### id

```ts
id: string;
```

Numeric id split out of the gid (`gid://shopify/Product/123` → `"123"`), falling back to the whole gid if it carries no numeric segment. The core keys its subscription-offer index by this AND by `handle`, so the handle key covers either form.

##### images

```ts
images: string[];
```

##### price

```ts
price: number | null;
```

##### title

```ts
title: string;
```

##### url

```ts
url: string;
```

Always canonical `/products/{handle}` — see `toAjaxProduct`.

##### variants

```ts
variants: JoyAjaxVariant[];
```

***

### JoyAjaxVariant

A variant in the Ajax shape the core extractors read.

#### Properties

##### compare_at_price

```ts
compare_at_price: number | null;
```

##### id

```ts
id: string;
```

##### price

```ts
price: number | null;
```

##### sellingPlanAllocations

```ts
sellingPlanAllocations: object[];
```

Flattened per-delivery prices, in cents. The widget core accepts this
camelCase spelling and this key, so it needs no change.

###### perDeliveryPrice

```ts
perDeliveryPrice: number;
```

***

### JoyCollection

One entry of the promoted-collections strip, in the shape the core's
`loadPromotedCollections` hands straight to the component
(`host/data-port.ts`'s `PromotedCollection`).

⚠️ No `productCount`. The Liquid path reads it from
`/collections/{handle}.json`, but the Storefront API's `Collection` type
exposes no product-count field at all (verified against
`@shopify/hydrogen-react/storefront.schema.json`) and counting via
`products(first:250)` would cost a page fetch per collection for one number.
Omitting it is safe: `joy-promoted-collections.ts:390` hides the count when
it is null, so headless shows the same strip minus that one line.

#### Properties

##### handle

```ts
handle: string;
```

##### id

```ts
id: string;
```

Numeric id split out of the gid, same treatment as `JoyAjaxProduct.id`.

##### image?

```ts
image?: string;
```

Featured image URL; absent when the collection has none, so the component draws its monogram fallback.

##### title

```ts
title: string;
```

##### url

```ts
url: string;
```

Always canonical `/collections/{handle}`.

***

### JoyCollectionsResponse

Mode C's payload. Has no `products` key — the caller reads `collections`.

#### Properties

##### collections

```ts
collections: JoyCollection[];
```

The collections that resolved, in the merchant's configured order.
Collections the shop no longer has are **dropped, not nulled**: this is a
curated strip the merchant arranged, so a shorter strip reads better than a
hole. Mode A nulls instead because its caller maps results back per handle.

***

### JoyProductsContext

The subset of the Hydrogen route context this handler needs.

#### Properties

##### storefront

```ts
storefront: JoyProductsStorefront;
```

***

### JoyProductsLoaderArgs

Structural shape of a Hydrogen/Remix loader's args.

#### Properties

##### context

```ts
context: JoyProductsContext;
```

##### request

```ts
request: Request;
```

***

### JoyProductsResponse

#### Properties

##### currencyCode

```ts
currencyCode: string | null;
```

Currency of the returned prices, so the widget formats them with the buyer's symbol rather than the hardcoded `'USD'`. `null` when nothing came back.

##### handles?

```ts
handles?: string[];
```

Mode A only — the handles actually queried, after the allow-list, the cap and de-duplication. Lets the caller line `products` up without re-deriving that filtering.

##### products

```ts
products: (JoyAjaxProduct | null)[];
```

Mode A: one entry per accepted handle, `null` where the shop has no such product. Mode B: the recommended/fallback products, seed excluded.

***

### JoyProductsStorefront

The subset of a Hydrogen `storefront` client this route uses.

#### Methods

##### query()

```ts
query(query, options): Promise<unknown>;
```

###### Parameters

| Parameter              | Type                                                                       |
| ---------------------- | -------------------------------------------------------------------------- |
| `query`                | `string`                                                                   |
| `options`              | { `displayName?`: `string`; `variables?`: `Record`<`string`, `unknown`>; } |
| `options.displayName?` | `string`                                                                   |
| `options.variables?`   | `Record`<`string`, `unknown`>                                              |

###### Returns

`Promise`<`unknown`>

## Functions

### loader()

```ts
function loader(__namedParameters): Promise<Response>;
```

Hydrogen resource-route loader. Always resolves to a `Response`; never throws.

#### Parameters

| Parameter           | Type                                              |
| ------------------- | ------------------------------------------------- |
| `__namedParameters` | [`JoyProductsLoaderArgs`](#joyproductsloaderargs) |

#### Returns

`Promise`<`Response`>
