Skip to content
themeforge
EN
Start free
Menu
  1. Home
  2. Section recipes
  3. Product catalogue
Recipe 4 steps

A product catalogue: sorting, cards and prices

The WooCommerce shop page in your design: a heading and a couple of lines at the top, then sorting and product cards with prices. New products appear in the catalogue by themselves.

What you get

Markup archive-product.html
<body wp-fields-group="Shop">
<header class="shop-hero">
  <h1 wp="post-title">Beans</h1>
  <p class="shop-hero__lead" fld-area="Shop lead">Roasted on Mondays, shipped on Tuesdays.</p>
</header>
<form class="sort" wp="sort">
  <select class="sort__select" wp="orderby">
    <option value="menu_order">Default</option>
    <option value="price">Price: low to high</option>
  </select>
</form>
<div class="beans" wp="products">
  <div class="bean-card">
    <a href="#" wp="post-link"><img src="images/bean.jpg" alt="" wp="post-image"></a>
    <h3><a href="#" wp="post-title-link">Ethiopia Yirgacheffe</a></h3>
    <div class="bean-card__prices">
      <span wp="product-price">$14.00</span>
      <span wp="product-price-sale">$12.00</span>
      <span class="is--old" wp="product-price-regular">$14.00</span>
    </div>
  </div>
</div>
<div class="beans__empty" wp="no-results">No beans match.</div>
<div class="pagination" wp-paginate="mid_size=1"></div>
</body>
In the admin Pages → Beans
Pages → Beans
  • Title: Beans
  • WooCommerce → Settings → Products → Shop page: Beans
Shop
Shop lead Roasted on Mondays, shipped on Tuesdays.
Products
  • Ethiopia Yirgacheffe — $14.00
  • Colombia Huila — $13.00
  • Brazil Cerrado — $11.00
  • House blend “Warm” — $12.00
On the site shop page
Beans

Roasted on Mondays, shipped on Tuesdays.

Price: low to high
Brazil Cerrado $11.00
House blend “Warm” $12.00
Colombia Huila $13.00
1 2 →

A customer picked “Price: low to high”, and the cards were sorted again.

Step by step

  1. Heading and intro

    wp="post-title" and fld-area above the cards read the shop page, the one chosen in WooCommerce → Settings → Products. The client edits it like any page.

    <h1 wp="post-title">Beans</h1>
    <p class="shop-hero__lead" fld-area="Shop lead">Roasted on Mondays, shipped on Tuesdays.</p>
  2. Sorting

    <form wp="sort"> with a <select wp="orderby"> inside. The option values are WooCommerce sort orders: menu_order, price, price-desc, date, popularity, rating.

    <form class="sort" wp="sort">
      <select class="sort__select" wp="orderby">
        <option value="menu_order">Default</option>
        <option value="price">Price: low to high</option>
      </select>
    </form>
  3. Product cards

    wp="products" on the grid; the first card is the sample. Inside are the link, image, name and three price blocks: the theme hides the ones that do not apply. Next to it, wp="no-results".

    <div class="beans" wp="products">
      <div class="bean-card">
        <a href="#" wp="post-link"><img src="images/bean.jpg" alt="" wp="post-image"></a>
        <h3><a href="#" wp="post-title-link">Ethiopia Yirgacheffe</a></h3>
        <div class="bean-card__prices">
          <span wp="product-price">$14.00</span>
          <span wp="product-price-sale">$12.00</span>
          <span class="is--old" wp="product-price-regular">$14.00</span>
        </div>
      </div>
    </div>
    <div class="beans__empty" wp="no-results">No beans match.</div>
  4. Page numbers

    wp-paginate on an empty block after the grid.

    <div class="pagination" wp-paginate="mid_size=1"></div>

What matters

  • Needs WooCommerce.
  • Without a separate taxonomy-product-cat.html, product categories open with this same template, and wp="products" shows the products of the open category.
  • Products on another page, such as the home page, come from wp-product-query.

Common mistakes

The build log is the “Logs” tab of your project on themeforge.pro; the free markup check shows the same notes.

Not like this
<div class="beans" wp-query="'post_type'=>'product','posts_per_page'=>12">
  <div class="bean-card">
    <h3 wp="post-title">Ethiopia Yirgacheffe</h3>
  </div>
</div>

wp-query instead of wp="products" shows a selection of its own: sorting and product categories do not affect it. The log stays silent.

Like this
<div class="beans" wp="products">
  <div class="bean-card">
    <h3 wp="post-title">Ethiopia Yirgacheffe</h3>
  </div>
</div>

wp="products" shows the products WooCommerce picked for this page.

Not like this
<select class="sort__select" wp="orderby">
  <option value="price">Price: low to high</option>
</select>

A sort list without its form: the build notes the attribute in the log, and it does nothing.

Like this
<form class="sort" wp="sort">
  <select class="sort__select" wp="orderby">
    <option value="price">Price: low to high</option>
  </select>
</form>

The list goes inside <form wp="sort">.

Attributes in this recipe

Ready when you are

See your site’s WordPress admin before you pay.