Total weight at bottom of email-order-details.php
-
Hi,
I have been playing around with this template and got some code working in it. However I’m not sure if this “Total Weight code” needs a child theme template or not. Otherwise next update it will be gone. Is there a way to add this to the Functions.php, or is creating another template in a Child Theme better?
wp-content/plugins/kadence-woocommerce-email-designer/templates/woo/emails/email-order-details.php
if ( ‘new_order’ != $email->id ) return;
$total_weight = 0;
foreach( $order->get_items() as $item_id => $product_item ){
$quantity = $product_item->get_quantity(); // get quantity
$product = $product_item->get_product(); // get the WC_Product object
$product_weight = $product->get_weight(); // get the product weight
// Add the line item weight to the total weight calculation
$total_weight += floatval( $product_weight * $quantity );
?>
<tr>
<th class=”td” scope=”row” colspan=”2″ style=”text-align:<?php echo esc_attr( $text_align ); ?>;”><?php esc_html_e( ‘Note:’, ‘woocommerce’ ); ?></th>
<td class=”td” style=”text-align:<?php echo esc_attr( $text_align ); ?>;”><?php echo wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ); ?></td>
</tr>
<?php
}
- The topic ‘Total weight at bottom of email-order-details.php’ is closed to new replies.