Blog
Electricity prices in Denmark are genuinely hard to compare. Providers mix fixed, variable, and combined rates, charge different fees depending on how you pay, bind you for different lengths of time, and quote different prices for West and East Denmark. Faced with all of that, most people cannot tell which deal is actually cheapest for their own home. A Danish comparison site wanted to answer that question in seconds, but it had no engine to do it.
Electricity Price Comparison is that engine. It is a custom Drupal build for a Danish electricity comparison site: an Electricity Offer content type for structured offer data, live multi-select filters, and a monthly price calculated from each visitor’s own usage. Visitors set their expected yearly consumption and their region, tick the filters they care about, and see every offer re-priced and re-sorted for their situation, cheapest first.
Put simply, the price a visitor sees is theirs, not a generic headline number. Move the usage slider or change a filter and every offer’s monthly cost recalculates and the list re-sorts, instantly, without a page reload. The site owner adds and edits offers from the Drupal admin, and the custom code stays small so the whole thing is cheap to maintain.
The client wanted something that worked like the leading Danish comparison sites, where the number on screen reflects your household and the filters feel alive. A static table of prices could never do that. The requirements set the bar.
The page puts the filters on the left and the offers on the right. Visitors choose West or East Denmark, move a slider for their expected yearly consumption, and tick filters for price type, binding period, monthly payment, and provider. Mirroring a complex comparison interface this closely, inside the client’s existing site, is where the Drupal development services behind the project earned their keep. A visit flows like this:
The monthly price is worked out live as yearly usage divided by twelve, multiplied by the cost per kWh, plus the cheapest monthly payment fee that provider offers; fees a provider does not offer are simply hidden. In the admin, the owner creates each offer as a content item and fills in its fields, and it appears in the list automatically.
The comparison runs on Drupal 10, with a dedicated content type for structured offer data, Views for the list and filters, and Twig templates for the layout. The challenge was never creating a content type. It was mirroring a live, multi-select comparison interface with a slider that recalculates every price, correct sorting, and fees that appear only when they apply, all inside the client’s existing site.
The part worth engineering carefully was the calculation itself. Every offer had to recalculate on each slider move, the list re-sort, and the monthly price and per-kWh cost land on the correct lines, matching the reference site exactly. Because the price logic and filters live in a custom module and Views configuration rather than the theme, a future theme only needs its own Twig templates.
In an early version the monthly prices did not change as the usage slider moved, so the calculation was rewired to recalculate every offer on each slider move using the agreed formula, then re-sort the list and place the figures on the correct lines. The first filter build used fixed option lists; after client feedback the filter options were connected to the field values and terms, so the filters always reflect the data the owner enters. Development had also accumulated extra modules, test content, and debug logging, so at the client’s request the unused modules were uninstalled, test data cleaned up, and browser logging removed, leaving only what the feature needs. Finally, the client planned a theme redesign after launch, which is exactly why the price logic sits in a custom module and the config was exported and documented on video for the handover.
A comparison that genuinely prices for each household is what makes energy and utility comparison businesses worth trusting, because the more accurate the number, the more visitors act on it.
The electricity comparison went live in September 2024, was refined through two rounds of feedback, and was approved in October 2024 with a strong review. The offers carry full parity with the reference site, eleven fields including the five-fee group; the filters are multi-select, instant, and resettable; the default sort puts the cheapest deal at the top; and the site owner can add a new offer as a single content item. The site answers the question people actually have: which deal is cheapest for me.
The build holds up because the comparison logic is structured, data-driven, and kept out of the theme, so it survives a redesign. If you are building a comparison or marketplace engine, you can hire full-stack developers who have built this kind of live-pricing Drupal tool, or tell us how your offers are priced and we will turn the rules into a calculator your visitors can trust.
What does the electricity comparison engine do?
It lets visitors to a Danish comparison site find the cheapest electricity deal for their own home. They set their yearly usage and region, apply filters, and see every provider’s offer priced for their usage and sorted cheapest first, with a button through to each provider.
How is each monthly price calculated?
The price is worked out live as yearly usage divided by twelve, multiplied by the cost per kWh, plus the cheapest monthly payment fee that provider offers. Fees a provider does not offer are hidden, and every price recalculates whenever the usage slider moves.
Why build it on Drupal 10?
Drupal 10 gives structured content and a clear admin, which the comparison depends on. Each offer is a dedicated content type with defined fields, and that structure is what makes accurate filtering, sorting, and calculation possible without resorting to free text.
How do the filters update so quickly?
The filters are built on Views with Better Exposed Filters using AJAX, so results update without reloading the page. Visitors can combine several selections at once, reset them with one button, and the options are read from the real field values so they always match the data.
Can the site survive a future theme redesign?
Yes. The price logic and filters live in a custom module and Views configuration rather than in the theme, so a new theme only needs its own Twig templates. The module, formula, and config export were documented on video at handover for exactly that reason.