In woocommerce, I have added a custom fee using the following code:
add_action( 'woocommerce_cart_calculate_fees', 'custom_fee_based_on_cart_total', 10, 1 );
function custom_fee_based_on_cart_total( $cart_object ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
// The percetage
$percent = 10; // 15%
// The cart total
$cart_total = $cart_object->cart_contents_total;
// The conditional Calculation
$fee = $cart_total >= 25 ? $cart_total * $percent / 100 : 0;
if ( $fee != 0 )
$cart_object->add_fee( __( "Gratuity", "woocommerce" ), $fee, false );
}
I just want to swipe the fees order like I want "Fee per person" after the sub total and "Gratuity" after "Fee per person".