I searched the whole site and found some solutions Unfortunately, the codes are obsolete.
I would like to add a fixed commission to the cart, but I would like this commission to be multiplied by the number of items.
I used this code to apply the flat fee:
add_action('woocommerce_cart_calculate_fees', function() {
if (is_admin() && !defined('DOING_AJAX')) {
return;
}
WC()->cart->add_fee(__('PCU Eco Tassa', 'txtdomain'), 2.30);
});
This increases € 2.30 of the total, but I need this value 2.30 to be multiplied by the number of products.
This shop sells car tires. For example, if I buy a tire, the extra fee must be 2.30, but if I buy 3 tires, regardless of the cost of each product, The value 2.3 must be multiplied by 3, And it must give me 6.9 as a result.
Unfortunately for me It is difficult and I do not know PHP language, I believe and hope that it is simple AND that someone can help me.
I thank everyone in advance