A simple, powerful and independent e-commerce platform.
Sell anything with ease.

Show product dimensions on category page

This code will display the product dimensions (if available) onto the category page.

/**
 * Show product dimensions on category page
 */

add_action('woocommerce_after_shop_loop_item', 'cc_show_dimensions', 9);

function cc_show_dimensions() {

  global $product;
  $dimensions = wc_format_dimensions($product->get_dimensions(false));

  if ($product->has_dimensions()) {
    echo '<div class="product-meta"><span class="product-meta-label">Dimensions: </span>' . $dimensions . '</div>';
  }

}
View Raw Code ID: 1078