Skip to content

Instantly share code, notes, and snippets.

@webtoffee-git
Last active April 28, 2025 08:49
Show Gist options
  • Save webtoffee-git/1a73c24fe04bfb9ac70da9e608ea1b6a to your computer and use it in GitHub Desktop.
Save webtoffee-git/1a73c24fe04bfb9ac70da9e608ea1b6a to your computer and use it in GitHub Desktop.
Code to Add Product Weight Below Product Name in Email Template - By WebToffee(WebToffee eCommerce Marketing Automation – Email marketing, Popups, Email customizer)
<?php //Do not copy this line of code
add_action('woocommerce_order_item_meta_end', function($item_id, $item, $order, $plain_text) {
$product = $item->get_product();
if (!$product) return;
$weight = $product->get_weight();
if(!empty($weight)){
echo '<br><b class="wt_product_weight">' . __('Weight:', 'woocommerce') . '</b> ' . ($weight . ' ' . get_option('woocommerce_weight_unit') );
}
}
, 10, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment