How to apply discount based on last order count

How to apply a discount based on the last order count

This feature is used to apply the discount if the user places more than specific order using the same user login.

For eg.: If the user place more than 11 order then allow adding $21.99 as bulk order discount on their 12th order.

 Screenshot - 1: (Admin: Setting for order count)

In the above settings, it will check if the user placing 11 or more orders or not. If Yes then it will apply the discount on that order and every order after that.

Screenshot - 2: (Checkout: Bulk order discount)