Skip to content
ThemesIonic — home
WooCommerce

WooCommerce Product Card Design: What Builds the Card and How to Change It

A WooCommerce product card is either five inner blocks in a Product Template or five hooks in content-product.php. Knowing which, and the default order of each, makes redesigns short and fixes ragged rows.

Updated 6 min read intermediate

A WooCommerce product card is built from five parts, image, sale badge, title, price and button, and you change it in one of two places: the Product Template block in a block theme, or the hooks in content-product.php in a classic theme. Work out which one your shop uses before you write any CSS.

Which system draws your card

In a block theme such as Twenty Twenty-Five, WooCommerce uses its block-based Product Catalog template, and the grid is a Product Collection block. There is one exception. Stores upgraded from older versions can still have a template containing a block labelled Product Grid (Classic). That block renders the PHP template, so the classic hooks below apply even though the theme is a block theme. The switch is the wc_blocks_use_blockified_product_grid_block_as_template option. When it isn't set, block themes get the block template.

To check, open Appearance > Editor > Templates > Product Catalog and click the grid. If the block is Product Collection, use the first table. If it is Product Grid (Classic), or the theme is not a block theme, use the second.

Block card: element, block, setting

Card element Block (name) Default in the Shop template Where to change it
Grid Product Collection (woocommerce/product-collection) Grid layout, 3 columns, Responsive on Columns and Responsive ("Automatically adjust the number of columns to better fit smaller screens.")
Card wrapper Product Template (woocommerce/product-template) Each product is an <li class="wc-block-product"> Spacing, border, colour on the block. Inner block order is the card layout
Image Product Image (woocommerce/product-image) Image sizing "thumbnail", no fixed ratio, scale cover, linked to the product Aspect ratio under the block's dimension settings overrides the store setting
Sale badge On-Sale Badge (woocommerce/product-sale-badge), nested inside Product Image Aligned right, text "Sale" Badge text, or the saved amount or percentage ("Up to …" for variable products)
Title Core Title block (core/post-title) shown as Product Title Heading level 2, linked, centred Level, link, typography. The older woocommerce/product-title block also exists, but the default card does not use it
Price Product Price (woocommerce/product-price) Centred, small font Alignment, typography, colour
Button Add to Cart Button (woocommerce/product-button) Centred, small font Width, alignment, colour. The text comes from the product type

Two details catch people out. First, an image with no aspect ratio, when Image sizing is thumbnail, follows Thumbnail cropping under Appearance > Customize > WooCommerce > Product Images (1:1, Custom, or Uncropped). Uncropped returns no ratio at all, so mixed uploads make every row uneven. A Product Collection you insert yourself starts with its image set to 1/1, so two grids on the same site can look different. Second, the Product Image block has its own "show sale badge" setting, switched off in the defaults. The badge you see is the separate nested block, so delete that block, not the setting.

Classic card: position, hook, default callback

content-product.php is just an <li> that runs five actions. WooCommerce attaches these callbacks by default:

Position Hook Default callback (priority)
Start of card woocommerce_before_shop_loop_item woocommerce_template_loop_product_link_open (10): opens the link around image, title, price and rating
Above title woocommerce_before_shop_loop_item_title woocommerce_show_product_loop_sale_flash (10), then woocommerce_template_loop_product_thumbnail (10)
Title woocommerce_shop_loop_item_title woocommerce_template_loop_product_title (10): outputs <h2 class="woocommerce-loop-product__title">
Below title woocommerce_after_shop_loop_item_title woocommerce_template_loop_rating (5), then woocommerce_template_loop_price (10)
End of card woocommerce_after_shop_loop_item woocommerce_template_loop_product_link_close (5), then woocommerce_template_loop_add_to_cart (10)

The sale flash and the thumbnail share priority 10, so the flash prints first only because it is registered first. To move the price above the title, remove it and re-add it to woocommerce_before_shop_loop_item_title at 20:

add_action( 'init', function () {
	remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
	add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_price', 20 );
} );

remove_action() must use the priority the callback was added with, or it silently does nothing. Anything added at woocommerce_after_shop_loop_item priority 6–9 lands after the link closes, beside the button. The thumbnail uses the woocommerce_thumbnail size, so the same Thumbnail cropping setting decides its ratio. The mechanics of that size are in product image sizes. Changes to the grid's surroundings rather than the card belong in woocommerce_before_shop_loop and the wider archive customisation.

Equal-height cards: the CSS gotcha

In the block grid, the <li> items are already the same height: with Responsive on, the template is a CSS grid, and grid items stretch. The content inside doesn't stretch, though, so a two-line title pushes one button lower than its neighbours. Make the card a column and push the button to the bottom:

.wc-block-product-template .wc-block-product {
	display: flex;
	flex-direction: column;
}
.wc-block-product .wc-block-components-product-button {
	margin-top: auto;
}
.wc-block-product .wp-block-post-title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

The classic grid has a different trap. woocommerce-layout.css floats li.product and adds clearfix ::before and ::after pseudo-elements to ul.products. If you switch ul.products to display: grid without hiding them, each pseudo-element takes a grid cell, and the first card appears shifted one column with an empty gap before it:

.woocommerce ul.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }
.woocommerce ul.products::before,
.woocommerce ul.products::after { display: none; }
.woocommerce ul.products li.product { float: none; width: auto; margin: 0; display: flex; flex-direction: column; }
.woocommerce ul.products li.product .button { margin-top: auto; }

If the stylesheet seems to have no effect, check load order and selectors first (CSS not loading).

What to put on the card

Image, name, price and a clear next step are enough. Every extra element slows scanning:

  • Sale badges only work if they are rare. A badge on every card is noise. See product badges.
  • Ratings add value with real review volume. Empty stars on every card look like an abandoned shop.
  • The button behaves differently by product type. Simple products show "Add to cart" and add to the cart from the grid. Variable products show "Select options" and link to the product page. Out-of-stock or non-purchasable products show "Read more". If shoppers see these side by side, style them differently or link every card to the product page.

Common mistakes

  • Editing CSS for ul.products li.product on a block theme that renders wc-block-product items, or the reverse.
  • Removing a loop callback at the wrong priority, then wondering why the element is still there.
  • Setting an aspect ratio on one Product Image block and expecting the Shop template, which follows the store cropping setting, to match.

Verify

Load a category with simple, variable and on-sale products at phone and desktop widths. Each row should have the images, titles, prices and buttons at the same height. The badge should appear only on sale items. Each button text should match its product type.

Frequently asked

Usually the images. The block Shop template follows the Thumbnail cropping setting under Appearance > Customize > WooCommerce > Product Images, so with Uncropped every image keeps its own ratio. Choose 1:1 or Custom, or set an aspect ratio on the Product Image block. Titles wrapping to different line counts are the second cause, fixed with a line clamp and a flex column.
Open Appearance > Editor > Templates, edit the Product Catalog template and select the Product Template inside the Product Collection block. Its inner blocks are the card: drag them to reorder, delete what you don't need, or insert Product Rating or a Product Summary. Columns and the Responsive toggle are on the Product Collection block.
Variable products cannot be added from the grid, so their button text is Select options and it links to the product page. Simple products show Add to cart, and anything out of stock or not purchasable shows Read more. All three come from add_to_cart_text() and can be changed with the woocommerce_product_add_to_cart_text filter.

Related guides