Last active
December 7, 2021 08:40
-
-
Save AnanthFlycart/a4cc0d49e61f63a862bb9f2dee962393 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
| // Return filter passed true, only if all the attribute filters are passed | |
| add_filter('advanced_woo_discount_rules_filter_passed', function ($filter_passed, $rule, $product, $sale_badge, $product_table, $conditionFailed) { | |
| if (method_exists($rule, 'getFilter')) { | |
| $filters = $rule->getFilter(); | |
| if ($filter_passed && !empty($filters) && class_exists('\Wdr\App\Helpers\Filter')) { | |
| $filter_helper = new \Wdr\App\Helpers\Filter(); | |
| foreach ($filters as $filter) { | |
| if ($filter->type == 'product_attributes') { | |
| $filter_piece = (object) array($filter); | |
| $attribute_filter_passed = $filter_helper->matchFilters($product, $filter_piece, $sale_badge, $product_table); | |
| if ($attribute_filter_passed === false) { | |
| return false; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| return $filter_passed; | |
| }, 10, 6); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment