Handling Multiple Relations in payload CMS

You can specify multiple relations within a single field by setting relationTo as an array:

{
  name: 'relatedItems',
  type: 'relationship',
  relationTo: ['products', 'categories'],
  hasMany: true,
}

This allows referencing multiple collections (products and categories) in a single field.

Leave a comment

Your email address will not be published. Required fields are marked *