Last active
October 18, 2024 13:53
-
-
Save plugin-republic/290885b6d1756d6897e9de841c0e9845 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 | |
/** | |
* Array of discount rates | |
*/ | |
function prefix_discount_rates( $rates, $product_id ) { | |
$excluded_ids = array( 1234 ); | |
if( in_array( $product_id, $excluded_ids ) ) { | |
return $rates; | |
} | |
$rates = array( | |
array( | |
'rate' => 20, | |
'after' => 10, | |
'from' => 'all' | |
), | |
array( | |
'rate' => 55, | |
'after' => 30, | |
'from' => 'all' | |
), | |
array( | |
'rate' => 60, | |
'after' => 90, | |
'from' => 'all' | |
) | |
); | |
return $rates; | |
} | |
add_filter( 'bfwc_discount_rates', 'prefix_discount_rates', 10, 2 ); | |
function prefix_discount_type( $type, $product_id ) { | |
return 'percentage'; | |
} | |
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