Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Last active March 20, 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/290885b6d1756d6897e9de841c0e9845 to your computer and use it in GitHub Desktop.
Save plugin-republic/290885b6d1756d6897e9de841c0e9845 to your computer and use it in GitHub Desktop.
<?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