I am using this piece of code found elsewhere on stackoverflow, it applies a surcharge to bring the cart total up to £25, it works correctly except that tax (VAT) is only being calculated based on the original sub total rather than the total including the surcharge - very new to PHP, not sure what to change or add, any help greatly received :)
//ADD SMALL ORDER SURCHARGE IN CART
function woo_add_cart_fee( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
// Get subtotal
$subt = $cart->get_subtotal();
// Below
if ($subt < 25 ) {
$surcharge = 25 - $subt;
$cart->add_fee( __('Min. £25 Small order charge', 'woocommerce' ), $surcharge );
}
}
add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee', 10, 1 );
add_action( 'woocommerce_cart_calculate_fees', 'woo_add_cart_fee' );