Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created March 13, 2024 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/0fa0a31e30ae48dc3deedd4d47c1192a to your computer and use it in GitHub Desktop.
Save plugin-republic/0fa0a31e30ae48dc3deedd4d47c1192a to your computer and use it in GitHub Desktop.
<?php
/**
* Filter Bookings discount rates
*/
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