Roundoff Weight for Shipping Calculation
-
Hi,
I want to round off the weight to Upper Value (Ex: 2.4 to 3 ) for the calculations of the shipping charge. Now the shipping cost is calculated based on the exact weight.
add_filter( ‘woocommerce_cart_contents_weight’, ‘custom_cart_contents_weight’, 10, 1 );
function custom_cart_contents_weight( $weight ) {
$weight = ceil($weight);
return $weight;
}I have tried the above code but still, the shipping cost is calculated based on the exact weight. (ex: if I charge $10/Kg for 2.4Kg the shipping cost will be $24 but I want it to be $30 ).
I even tried using this hook – woocommerce_add_cart_item_data but nothing changes.
I hope the question is clear.
Thanks
- The topic ‘Roundoff Weight for Shipping Calculation’ is closed to new replies.