Adding fee based on the cart total
-
I am trying to add fee based on the cart total. But the fee adds on woocommerce_cart_calculate_fees. But I don’t know how to make it based on cart total. When the updated or deleted, the total change, so I am unable to get proper total and add fee.
function woo_add_cart_fee() { $cart_total = ; $fee = (int)$cart_total*5/100; WC()->cart->add_fee( 'Credits :', $fee, false, '' ); } } } add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );
This is my code. I am unable to find the way. Can i get help.? Thanks in advance.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Adding fee based on the cart total’ is closed to new replies.