Skip to content

Quote request form in WordPress

A short form for tradespeople: type of job, description, postcode, timeframe, optional photos, then a confirmation summary.

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

formulaire-demande-devis.php
<?php
/**
 * Plugin Name: Forge, Formulaire de demande de devis
 * Description: Un formulaire court pour artisan : type de prestation, description, code postal, délai, photos facultatives, puis un récapitulatif de confirmation. Ajoute la composition « Formulaire de demande de devis » à 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-formulaire-demande-devis
 *
pattern.html
<!-- wp:html -->
<div class="qrf" data-qrf>
        <div class="qrf__head">
          <p class="qrf__eyebrow">Atelier Morel · Plomberie et chauffage</p>
          <h2 class="qrf__title" id="qrf-titre">Demander un devis</h2>
          <p class="qrf__intro">Décrivez votre besoin en deux minutes : nous vous répondons sous 48 h ouvrées avec une estimation chiffrée, sans engagement.</p>
        </div>
        <form class="qrf__form" novalidate action="#qrf-envoi" aria-labelledby="qrf-titre">
          <p class="qrf__note">Tous les champs sont obligatoires, sauf mention « facultatif ».</p>
          <div class="qrf__summary" tabindex="-1" role="group" aria-labelledby="qrf-summary-title" data-qrf-summary hidden>
            <h3 class="qrf__summary-title" id="qrf-summary-title" data-qrf-summary-title></h3>
            <ul class="qrf__summary-list"></ul>
script.js
(() => {
  if (!document.querySelector(".qrf")) return;
  const QRF_RULES = {
    prestation: (form) => (form.elements.prestation.value ? "" : "Choisissez le type de prestation."),
    description: (form) => {
      const length = form.elements.description.value.trim().length;
      if (!length) return "Décrivez votre besoin en quelques phrases.";
      const missing = 20 - length;
      return missing > 0 ? `Ajoutez quelques détails : encore ${missing} caractère${missing > 1 ? "s" : ""} au minimum.` : "";
    },
    postal: (form) => {
      const value = form.elements.postal.value.trim();
style.css
:root {
  --qrf-card: #ffffff;
  --qrf-text: #2a1d14;
  --qrf-muted: #6b5a4c;
  --qrf-line: #e7dcd0;
  --qrf-line-strong: #8c7a6b;
  --qrf-field: #ffffff;
  --qrf-accent: #c2410c;
  --qrf-accent-strong: #9a3412;
  --qrf-accent-hover: #7c2d12;
  --qrf-accent-soft: #fff4ec;
  --qrf-accent-soft-hover: #ffe8d6;

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

Forms and inputs components in WordPress
  • A quote request form for tradespeople: the customer describes the work, picks a start date range and attaches up to six site photos, each with a preview, its size and a button to remove it.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A quote request form whose labels, hints and error messages are full French sentences, still readable at 320 px: nothing overflows, nothing is cut off, and each error is tied to its field.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Visitors pick a package and tick options: the pre-tax total, VAT and total including tax update live, and the summary is sent with the contact form.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A short NPS survey: a 0 to 10 score as radio buttons, then a follow-up question adapted to whether the customer is a detractor, passive or promoter.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An honest unsubscribe page: address prefilled from the link, choice between stopping everything or receiving less, optional reason and an undo.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A callback request form: French phone number checked and formatted, topic, working day and time slot, with explicit consent to the call.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component