Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Balakrishnan-flycart/f363bbd8d696b6be43d146ecee7f2c2b to your computer and use it in GitHub Desktop.
Save Balakrishnan-flycart/f363bbd8d696b6be43d146ecee7f2c2b to your computer and use it in GitHub Desktop.
Woo Discount Rules v2 - Check customized condition
add_filter('advanced_woo_discount_rules_check_condition', '__return_true');
add_filter('advanced_woo_discount_rules_is_conditions_passed', function($result, $rule_object, $rule){
$conditions = $rule_object->getConditions();
$rule_id = $rule_object->getId();
if(in_array($rule_id, array(1, 2))){
//Your custom logics enter here and return true or false
//true -> Run rule
//false -> Do not run rule
return true;
}
return $result;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment