How to apply discount based on last order amount

How to apply a discount based on the last order amount

This feature is used to allow a discount if the user's last order reaches a specific amount.

For eg.: If the user's last order is greater than $12,99 then allow a $21.99 discount on the second order.

Screenshot - 1: (Admin side last order condition)

Admin side last order condition

So here, if users had placed the last order for more than $1299 then they will get a discount of $21.99 once place their next order.