If we visit the wayback machine and look at the changelog for WooCommerce Bookings we can see that in November of 2015 a new coupon type was added to discount bookable persons. There is no equivalent coupon to discount by some number of blocks.
Fortunately, the WooCommerce Coupon class provides a filter that can be used to return a discount amount that is calculated dynamically based on the block cost of the bookable product.
The filter passes 6 parameters, the discount amount which is the value to be filtered and the amount that is being discounted, the cart item, a boolean to indicate whether or not this should apply to only one quantity or the entire line regardless of quantity, and an object representation of the coupon. We’ll need to use all of those in a callback function in order to be able to retrieve the coupon code.
The get_code method of the coupon class can be used to retrieve the coupon code of the current coupon. This can be used to conditionally target a specific coupon.
The cart item array contains an object representation of the bookable product with an array key of ‘data’. This object can be used to call the methods against the bookable product and get the block cost for this particular product.
Once all of that is put together, a new discount amount can be calculated based on the block cost and some arithmetic and assigned to the same variable name that the callback will return. All of that might look like this:
Not sure what to do with code snippets? See What Do I Do With These Code Snippets?