Subscription versus one-time purchase comparison in WordPress
Two offers and the cumulative cost over 1, 3 and 5 years of a monthly subscription and a one-time purchase, with the month the purchase pays for itself.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<!-- wp:html -->
<section class="tcaa" data-tcaa aria-labelledby="tcaa-titre">
<header class="tcaa__header">
<p class="tcaa__eyebrow">Tarifs</p>
<h2 id="tcaa-titre">Payer chaque mois ou une fois pour toutes ?</h2>
<p class="tcaa__intro">Comparez ce que coûte notre logiciel de facturation sur 1, 3 et 5 ans, puis gardez la formule qui vous convient.</p>
</header>
<div class="tcaa__cards">
<div class="tcaa__card">
<h3 class="tcaa__name">Abonnement</h3>
<p class="tcaa__tag">Le plus souple pour commencer</p>
<p class="tcaa__price"><span class="tcaa__amount">19 €</span> <span class="tcaa__period">par mois</span></p>(() => {
if (!document.querySelector(".tcaa")) return;
document.querySelectorAll("[data-tcaa]").forEach((root) => {
const rows = [...root.querySelectorAll("[data-tcaa-row]")];
const radios = [...root.querySelectorAll("[data-tcaa-choice]")];
const status = root.querySelector("[data-tcaa-status]");
const amount = (value) => value.toLocaleString("fr-FR") + "\u00a0€";
// The table is the single source of truth: changing its values is enough to update the chart.
const read = (row) => ({ sub: Number(row.dataset.tcaaSub), once: Number(row.dataset.tcaaOnce) });
const top = Math.max(...rows.map((row) => Math.max(read(row).sub, read(row).once)));
function bar(key, value) {:root {
--tcaa-text: #171a21;
--tcaa-body: #4a505c;
--tcaa-card: #ffffff;
--tcaa-line: #dde1e7;
--tcaa-track: #e6e9ee;
--tcaa-accent: #1d4ed8;
--tcaa-accent-hover: #1e40af;
--tcaa-on-accent: #ffffff;
--tcaa-ghost-hover: #eef1f5;
--tcaa-checked-bg: #171a21;
--tcaa-checked-text: #ffffff;<?php
/**
* Plugin Name: Forge, Comparatif abonnement contre achat unique
* Description: Deux offres et le coût cumulé sur 1, 3 et 5 ans d’un abonnement mensuel et d’un achat unique, avec le mois où l’achat devient rentable. Ajoute la composition « Comparatif abonnement contre achat unique » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-tarifs-comparatif-abonnement-achat-unique
*Free component: copy it freely, including for commercial projects.
Other pricing tables components in WordPress
Pricing tables components in WordPress
A table comparing what each license includes: update and support length, response time, number of sites, client hand-over. A switch extends support and updates the prices.
- Tailwind
- React
- CSS
- WordPress

Three one-time payment licenses, what each one allows line by line (client site, number of sites, resale) and the recommended plan highlighted.
- Tailwind
- React
- CSS
- WordPress

A session pack grid that computes the price per session and the money saved, with an optional reduced rate.
- Tailwind
- React
- CSS
- WordPress

Service cards with “from” prices, duration and a quote request button, filterable by family.
- Tailwind
- React
- CSS
- WordPress

Three plans side by side, the middle one highlighted.
- Tailwind
- React
- CSS
- WordPress

A single plan presented in detail, with a reassuring satisfaction guarantee.
- Tailwind
- React
- CSS
- WordPress