Codewerk.
Get a quote
Home/Blog/Custom fields or custom entities? Modelling data in Shopware 6

Custom fields or custom entities? Modelling data in Shopware 6

Custom fields are a five-minute solution that becomes a five-month problem. Here is the line at which you must switch to a real entity.

Photo: free stock photography (Unsplash licence) — see imprint

What custom fields really are

They are a JSON blob hanging off an existing entity. Wonderful for a handful of attributes; miserable as soon as you want to filter, sort, aggregate or join by them at scale. The database cannot index its way out of your JSON.

The switch line

The moment the data has its own lifecycle — it is created, changed and deleted independently of the product it hangs on — it is an entity, not a field. Contracts, service intervals, machine registrations: entities, every time.

Custom entities give you the whole platform

Define an entity and you get DAL access, API endpoints, admin CRUD and rule-builder access essentially for free. That is a lot of machinery you would otherwise hand-build around a JSON field, badly.

Migrating later is not free

Moving 200,000 products' custom fields into an entity means a data migration, an API contract change and a rewrite of everything that read them. Spending twenty minutes on this decision at the start is the cheapest twenty minutes of the project.

Key takeaways
  • Own lifecycle → entity. Simple attribute → custom field.
  • You cannot index your way out of a JSON blob.
  • Entities give you API, admin and rules for free.

We do this for a living — Shopware, Node.js, React, ERP integration and automation for B2B.

Talk to an engineer

// Keep reading

Related articles