Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save plugin-republic/d9a1b8ca0c2a6452984e9f61c0474157 to your computer and use it in GitHub Desktop.

Select an option

Save plugin-republic/d9a1b8ca0c2a6452984e9f61c0474157 to your computer and use it in GitHub Desktop.
<?php
/**
* Filter BXGY rule by brand taxonomy instead of category
*/
function demo_bxgy_taxonomy( $taxonomy, $rule, $rule_id ) {
$taxonomy = 'product_brand'; // Change this to the taxonomy or tag of your choice
return $taxonomy;
}
add_filter( 'wcfad_validate_bxgy_rule_taxonomy', 'demo_bxgy_taxonomy', 10, 3 );
function demo_bxgy_buy_categories( $buy_categories, $rule, $rule_id ) {
$buy_categories = array( 34 ); // This is the taxonomy term ID
return $buy_categories;
}
add_filter( 'wcfad_validate_bxgy_rule_buy_categories', 'demo_bxgy_buy_categories', 10, 3 );
function demo_bxgy_get_categories( $get_categories, $rule, $rule_id ) {
$get_categories = array( 33 ); // This is the taxonomy term ID
return $get_categories;
}
add_filter( 'wcfad_validate_bxgy_rule_get_categories', 'demo_bxgy_get_categories', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment