Add Total Cart Weight to Invoice
-
Is there a way I can add the order’s total weight to the invoice?
I was able to include the total weight on the admin/order page by putting the following code in functions.phpadd_action( 'woocommerce_checkout_update_order_meta', 'bbloomer_save_weight_order' ); function bbloomer_save_weight_order( $order_id ) { $weight = WC()->cart->get_cart_contents_weight(); update_post_meta( $order_id, '_cart_weight', $weight ); } add_action( 'woocommerce_admin_order_data_after_billing_address', 'bbloomer_delivery_weight_display_admin_order_meta', 10, 1 ); function bbloomer_delivery_weight_display_admin_order_meta( $order ) { echo '<p><strong>Order Weight:</strong> ' . get_post_meta( $order->get_id(), '_cart_weight', true ) . get_option( 'woocommerce_weight_unit' ) . '</p>'; }
Being able to add this to the invoice would be super helpful when creating shipping labels.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Add Total Cart Weight to Invoice’ is closed to new replies.