function iben_change_weight($weight, $order_id){
$order = wc_get_order($order_id);
if ( !is_a( $order, 'WC_Order' ) ){
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
$height = ($product->get_height() >= 0 ? $product->get_height() : 0);
$width = ($product->get_width() >= 0 ? $product->get_width() : 0);
$length = ($product->get_length() >= 0 ? $product->get_length() : 0);
$total_weight_dim += $quantity * (($height * $width * $length) / 5000);
if ($total_weight_dim > $weight){
$final_weight = $total_weight_dim;
add_filter('iben_elta_filter_weight_order_metabox', 'iben_change_weight', 10, 2);