×

 

Home Contact Us Payments SC Commerce SC Commerce Docs SC Commerce Snippets

Simply Computing

We make websites. Simple.

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', 'sc_woo_show_dimensions', 9);

function sc_woo_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: 91078