Support » Plugin: Kadence WooCommerce Email Designer » 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
    }

Viewing 1 replies (of 1 total)
  • Where are you outputting the $total_weight var? If after the whole table then you could reference this from a functions file because you could hook it into the template on the woocommerce_email_after_order_table action. Otherwise, you need to place the template in a child theme.

    Ben

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.