Snippets Card

Bootstrap 5 Product Card with Add to Cart Button

A single product card with image, badge, wishlist toggle, price, rating and clear add-to-cart and view-details buttons.

Bootstrap 5 No jQuery Aug 2020 2.2K views

<section class="wdw-stage">
  <div class="container" style="max-width:860px">
    <article class="wdw-card overflow-hidden pc row g-0 mx-auto">
      <div class="pc-media position-relative col-md-6">
        <img src="https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=600&q=80" alt="White smartwatch with a black display and silicone strap">
        <span class="badge text-bg-dark rounded-pill position-absolute top-0 start-0 m-3">New</span>
        <button type="button" class="pc-fav btn btn-light rounded-circle position-absolute top-0 end-0 m-3 p-0" aria-pressed="false" aria-label="Save to wishlist">
          <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1 1.1L12 21.3l7.8-7.8 1-1.1a5.5 5.5 0 0 0 0-7.8z"/></svg>
        </button>
      </div>
      <div class="p-4 p-md-5 col-md-6 d-flex flex-column justify-content-center">
        <p class="wdw-eyebrow mb-1">Timepieces</p>
        <h1 class="h4 fw-bold mb-2 text-body-emphasis">Yail Smart Watch</h1>
        <div class="d-flex align-items-center gap-2 small mb-3">
          <span class="text-warning d-inline-flex gap-1" aria-hidden="true"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3 6.1 20.6l1.3-6.6L2.5 9.4l6.6-.8z"/></svg><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3 6.1 20.6l1.3-6.6L2.5 9.4l6.6-.8z"/></svg><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3 6.1 20.6l1.3-6.6L2.5 9.4l6.6-.8z"/></svg><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3 6.1 20.6l1.3-6.6L2.5 9.4l6.6-.8z"/></svg><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" aria-hidden="true"><path d="M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3 6.1 20.6l1.3-6.6L2.5 9.4l6.6-.8z"/></svg></span>
          <span class="wdw-muted"><span class="visually-hidden">Rated </span>4.9<span class="visually-hidden"> out of 5</span> (212 reviews)</span>
        </div>
        <div class="d-flex align-items-baseline flex-wrap gap-2 mb-3">
          <p class="h3 fw-bolder mb-0 text-body-emphasis">$299</p>
          <s class="wdw-muted"><span class="visually-hidden">Was </span>$349</s>
          <span class="badge bg-success-subtle text-success-emphasis rounded-pill">Save 15%</span>
        </div>
        <p class="wdw-muted small mb-3">A 38 mm case, bright always-on display and a soft strap that fits most wrists.</p>
        <fieldset class="mb-3">
          <legend class="small fw-semibold mb-2 float-none w-auto">Colour: <span id="pcColourName" class="fw-normal wdw-muted">Cloud</span></legend>
          <div class="d-flex gap-2">
            <input type="radio" class="btn-check" name="pcColour" id="pcC1" value="Cloud" checked>
            <label class="pc-swatch rounded-circle" for="pcC1" style="--sw:#e5e7eb"><span class="visually-hidden">Cloud</span></label>
            <input type="radio" class="btn-check" name="pcColour" id="pcC2" value="Indigo">
            <label class="pc-swatch rounded-circle" for="pcC2" style="--sw:#4f46e5"><span class="visually-hidden">Indigo</span></label>
            <input type="radio" class="btn-check" name="pcColour" id="pcC3" value="Graphite">
            <label class="pc-swatch rounded-circle" for="pcC3" style="--sw:#374151"><span class="visually-hidden">Graphite</span></label>
          </div>
        </fieldset>
        <fieldset class="mb-4">
          <legend class="small fw-semibold mb-2 float-none w-auto">Strap size</legend>
          <div class="d-flex gap-2">
            <input type="radio" class="btn-check" name="pcSize" id="pcS1" checked>
            <label class="btn btn-outline-secondary rounded-pill px-3" for="pcS1">S/M</label>
            <input type="radio" class="btn-check" name="pcSize" id="pcS2">
            <label class="btn btn-outline-secondary rounded-pill px-3" for="pcS2">M/L</label>
          </div>
        </fieldset>
        <div class="d-grid gap-2">
          <button type="button" class="btn btn-primary rounded-pill" id="pcAdd">
            <svg class="pc-ico-cart" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6h15l-1.5 9H7.5zM6 6 5 3H2M9 20h.01M18 20h.01"/></svg>
            <svg class="pc-ico-check d-none" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>
            <span>Add to cart</span>
          </button>
          <a href="#" class="btn btn-outline-secondary text-body-emphasis rounded-pill">View details</a>
        </div>
        <p class="small text-success-emphasis mb-0 mt-3 d-flex align-items-center gap-2">
          <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"/></svg>
          In stock · free delivery in 2–3 days
        </p>
        <p class="visually-hidden" id="pcLive" role="status" aria-live="polite"></p>
      </div>
    </article>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.