Skip to content

Session pack pricing in WordPress

A session pack grid that computes the price per session and the money saved, with an optional reduced rate.

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

Open in a new tab

The code in WordPress

pattern.html
<!-- wp:html -->
<form class="tcs" data-tcs data-tcs-unit-price="14" data-tcs-reduced="20" aria-labelledby="tcs-titre">
        <h2 class="tcs-title" id="tcs-titre">Tarifs de la salle de bloc</h2>
        <fieldset class="tcs-fs">
          <legend class="tcs-sr">Choisissez une formule</legend>
          <div class="tcs-grid">
          <label class="tcs-card">
            <input class="tcs-radio" type="radio" name="tcs-carnet" value="1" data-price="14">
            <span class="tcs-name">Entrée</span>
            <span class="tcs-price" data-tcs-price>14 €</span>
            <span class="tcs-unit" data-tcs-unit>14 € la séance</span>
            <span class="tcs-save" data-tcs-save hidden></span>
script.js
(() => {
  if (!document.querySelector(".tcs")) return;
  document.querySelectorAll("[data-tcs]").forEach((root) => {
    const on = (el, type, fn) => el.addEventListener(type, fn);
    const form = root;
    const unit = Number(form.dataset.tcsUnitPrice);
    const reduced = Number(form.dataset.tcsReduced);
    const toggle = form.querySelector("[data-tcs-reduced-toggle]");
    const euro = (v) =>
      new Intl.NumberFormat("fr-FR", {
        style: "currency",
        currency: "EUR",
style.css
:root {
  --tcs-card: #ffffff;
  --tcs-bg: #f1f6f5;
  --tcs-text: #102522;
  --tcs-muted: #475b58;
  --tcs-line: #cfdcda;
  --tcs-accent: #0f766e;
  --tcs-accent-text: #ffffff;
  --tcs-picked: #e6f4f1;
  --tcs-save: #9a3412;
  --tcs-save-bg: #ffedd5;
  --demo-tarifs-carnets-seances-bg: #e5eeec;
tarifs-carnets-seances.php
<?php
/**
 * Plugin Name: Forge, Tarifs en carnets de séances
 * Description: Une grille de carnets de séances qui calcule le prix par séance et l’économie réalisée, avec un tarif réduit en option. Ajoute la composition « Tarifs en carnets de séances » à 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-carnets-seances
 *

Free component: copy it freely, including for commercial projects.

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
    Component
  • 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
    Component
  • Service cards with “from” prices, duration and a quote request button, filterable by family.

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

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component