Skip to content

Shop product card in WordPress

Visual, name, variant, customer rating and price, with an add-to-cart button.

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

carte-produit-boutique.php
<?php
/**
 * Plugin Name: Forge, Carte produit de boutique
 * Description: Visuel, nom, variante, note client et prix, avec un bouton d'ajout au panier. Ajoute la composition « Carte produit de boutique » à 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-carte-produit-boutique
 *
pattern.html
<!-- wp:html -->
<ul class="demo-carte-produit-boutique__grid">
      <li class="product">
        <div class="product__visual" aria-hidden="true"><svg viewBox="0 0 180 160"><path d="M30 70 L90 50 L150 70 L150 120 L30 120 Z" fill="#b9b4ad"/></svg></div>
        <div class="product__body">
          <h2><a href="#produit">Plaid en laine mérinos</a></h2>
          <p class="product__variant">Gris perle, 130 × 170 cm</p>
          <p class="product__rating"><span aria-hidden="true">★★★★★</span><span class="product__hidden">Note : 4,8 sur 5, 126 avis</span><span aria-hidden="true">4,8 (126)</span></p>
          <div class="product__footer">
            <p class="product__price">89 €</p>
            <button type="button">Ajouter au panier</button>
          </div>
style.css
:root {
  --card-bg: #ffffff;
  --card-line: #f1dfe3;
  --card-visual: #fdf2f4;
  --card-text: #3b0a18;
  --card-muted: #7a3a4a;
  --card-star: #b45309;
  --card-accent: #9f1239;
  --card-accent-text: #ffffff;
  --card-ring: #9f1239;
  --demo-carte-produit-boutique-bg: #fff8f9;
  --demo-carte-produit-boutique-text: #3b0a18;

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

Cards components in WordPress
  • A single-plan pricing card: struck-through price and discount, a places-left gauge driven by a data attribute, the list of everything included and a booking button that turns into a waiting list once sold out.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Three treatment cards in accessible neumorphism: gently raised surfaces, buttons that sink in when activated, a light/dark switch for the block itself. 3:1 outlines and AA text kept.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four fully clickable workshop cards in a neo-brutalist style: thick border, solid offset shadow and a card that sinks onto its shadow on hover or focus. Pastel tones, dark mode, no JavaScript.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Three brutalist service cards: one-pixel border, hard offset shadow that lifts on hover and sinks on click, large type, accent and dark variants. No JavaScript.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A mobile page to link from your social profiles: portrait, name, priority links (booking, WhatsApp, website, reviews, call), opening hours with an open or closed status, social links and a share button, in dependency-free HTML and CSS.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A seasonal promotion card with a struck-through price and discount that announces by itself whether the offer is coming, how many days are left or that it is over.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component