Merging discount codes into one dynamically on checkout

Is there a way to combine multiple discounts that a user enters in checkout into one while keeping the discount amount the same?

So for example if they enter codes “WELCOME10”, “BFCM20” we merge that into a single code that has the same output?