Last active
May 29, 2024 08:36
-
-
Save plugin-republic/0fa0a31e30ae48dc3deedd4d47c1192a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filter Bookings discount rates | |
* This snippet allows you to set fixed prices for multiple tiers | |
* In the array below: | |
* rate refers to the fixed price per unit | |
* after refers to the number of units where the rate kicks in | |
* from set to 'all' to apply the rate to the entire booking price | |
*/ | |
function prefix_discount_rates( $rates, $product_id ) { | |
$rates = array( | |
array( | |
'rate' => 3, | |
'after' => 10, | |
'from' => 'all' | |
), | |
array( | |
'rate' => 4, | |
'after' => 30, | |
'from' => 'all' | |
), | |
array( | |
'rate' => 5, | |
'after' => 90, | |
'from' => 'all' | |
) | |
); | |
return $rates; | |
} | |
add_filter( 'bfwc_discount_rates', 'prefix_discount_rates', 10, 2 ); | |
function prefix_discount_type( $type, $product_id ) { | |
return 'perunit'; | |
} | |
add_filter( 'bfwc_discount_type', 'prefix_discount_type', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment