Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active May 11, 2018 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/c9ba3493b13e9b4d803ae9a7a7237178 to your computer and use it in GitHub Desktop.
Save woogists/c9ba3493b13e9b4d803ae9a7a7237178 to your computer and use it in GitHub Desktop.
[General Snippets][Display product dimensions on archive pages] Display product dimensions on archive pages, below the title of the product for WooCommerce v3 and below
/**
* Show product dimensions on archive pages WC 3 and below
*/
add_action( 'woocommerce_after_shop_loop_item_title', 'wc_show_dimensions', 9 );
function wc_show_dimensions() {
global $product;
$dimensions = $product->get_dimensions();
if ( ! empty( $dimensions ) ) {
echo '<span class="dimensions">' . $dimensions . '</span>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment