Online block booking discount

I would love it if clients can choose to pay for a single or group of appointments when booking online. Currently if someone books into a group appointment online they can only pay the drop in price. In a class teaching situation, the ideal would be for them to be able to eg pay for a block of 6 and it then set up the case situation that counts down the “credits they have used” even better if an expiration date of credits can be set. For classes such as yoga often we would offer something like 6 classes for x amount that can be used within 8 weeks.