---
title: Function: generateProductRssFeed
slug: chord-ui/function-generateproductrssfeed
docTags: 
createdAt: 2023-11-06T15:03:31.904Z
---

[product-rss-feed](docId:6Uo_tqnsPfSBPjDRuymKw).generateProductRssFeed

▸ **generateProductRssFeed**(`rawProducts`, `options?`): `Promise`\<`string`>

`generateProductRssFeed` generates a RSS feed for your products. It can write
the feed to a file if you specify a `path`. It will also validate your products
against the [productRssFeedItemSchema](docId:-cRu_W1fPjdYjhe2xvoKc) for any validation issues.



[`z.ZodError`](https://github.com/colinhacks/zod/blob/78a409012a4dc34a455f5c4a7e028ca47c921e1b/ERROR_HANDLING.md) if there are any validation issues. You can find the issues by looking a the exceptions `issues` property to determine the exact issues. This only happens if \`options.strict = true'.



Minimal example with a single product that writes to the public directory in
Next.js.

```typescript
import { generateProductRssFeed } from '@chordcommerce/product-rss-feed/dist/simple'
import path from 'node:path'

async function main() {
  const product = {
    id: 'product-1',
    title: 'Product 1',
    description: 'Lorem ipsum',
    availability: 'in_stock',
    image_link: 'https://example.com/product-1.jpg',
    price: '10 USD',
    gtin: '00000000',
  }

  await generateProductRssFeed([product], {
    title: 'Plant Store',
    description: 'The best plants in the world',
    url: 'https://example.com',
    strict: true,
    path: path.join(process.cwd(), 'public', 'products.rss'),
  })
}

main()
```

### Parameters

| Name          | Type                                                      |
| ------------- | --------------------------------------------------------- |
| `rawProducts` | [`ProductFeedItemInput`](docId\:yHUy_ziKYbIkLrgVB3hKO)\[] |
| `options?`    | [`ProductFeedOptions`](docId\:K1i-GUuK6ZQyY-3nIfeDn)      |

### Returns

`Promise`\<`string`>

The RSS feed as a string.

### Defined in

[packages/product-rss-feed/src/simple/index.ts:344](https://github.com/chordcommerce/chord-ui/blob/2b105e1/packages/product-rss-feed/src/simple/index.ts#L344)
