In woocommerce we can add the fixed discount automatically of 10% if the cart total equal 5000 or greater than 5000
add_action( 'woocommerce_cart_calculate_fees', 'discount_based_on_cart_total', 25, 1 );
function discount_based_on_cart_total( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return;
$total = $cart->cart_contents_total;
// Percentage discount (10%)
if( $total >= 5000 )
$discount = $total * 0.1;
// Fixed amount discount ($20)
else
// $discount = 10;
// Add the discount
$cart->add_fee( __('discount', 'woocommerce'), -$discount );
}
Just paste the code in your functions.php file of theme and check it is working or not.
Thanks for visting and comment below if it is useful for You!!!!