How to add or remove coupons dynamically based on cart total, on WooCommerce

Imagine the scenario where we have 2 coupons, one (5off) that gives $5 discount to the total client order, as well as a coupon (10off) that gives $10 discount to the total client order. When the user inserts any of the coupons in, we want the $10 off coupon to apply only if the total …