Hello good, I have created a code where I add an item in the cart and it does not make the conversion.
This is my code:
add_filter( ‘woocommerce_cart_calculate_fees’,’add_engraving_fees’, 10, 1 );
function add_engraving_fees( $cart ) {
global $woocommerce;
global $product;
$peso= $woocommerce->cart->cart_contents_weight . ‘ ‘ . get_option(‘woocommerce_weight_unit’);
if ($peso < 1001){
$suma = 0.50;
}elseif($peso < 2001){
$suma = 62;
}elseif($peso < 3001){
$suma= 82;
}elseif($peso < 5001){
$suma= 175;
}elseif($peso < 10001){
$suma= 275;
}else{
$suma=275;
}
$cart->add_preci( ‘Envio Internacional ‘ . ‘ Por Kilo: (‘ . $woocommerce->cart->cart_contents_weight . ‘ ‘ . get_option(‘woocommerce_weight_unit’) . ‘)’ , $suma );
}`