Order’s total weight
-
Hello! I would need to see total weight of each order (admin panel only). I found this code but it doesn’t work. I see extra line “Total weight” but I don’t see any value even though I have added weight to some products before testing. Maybe you could help and precise how to add total weight?
add_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>'; }
The page I need help with: [log in to see the link]
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Order’s total weight’ is closed to new replies.