I'm using WOOT product filter for Woocommerce and trying to show search results in Husky (use to be WOOF) product table for Woocommerce.
These two are compatible but I'm code illiterate, using Divi theme builder.
I really just dont know what I'm doing with this and would really appreciate any guidance.
Developer told me to insert this code into functions.php for integration between WOOT and WOOF but it doesn't affect anything.
add_filter("woot_profile_extend", function($profile, $action, $shortcode_args) {
if ('woot_woocommerce_tables' === $action) {
if (isset($shortcode_args['filter_provider'])) {
if ($shortcode_args['filter_provider'] === 'woof') {
if (array_key_exists('WOOF', $GLOBALS)) {
global $WOOF;
$profile[0]['filter_provider'] = 'woof';
$profile[0]['filter_data'] = $WOOF->get_request_data();
add_action('woot_filter_provider_woof', function ($args, $filter_data) {
if (!is_array($filter_data)) {
$filter_data = json_decode($filter_data, true);
}
if (!empty($filter_data) AND is_array($filter_data)) {
foreach (array_keys($filter_data) as $key) {
if (is_integer($key)) {
unset($filter_data[$key]);
}
}
}
//***
//here is clean WOOF functionality
global $WOOF;
if ((isset($filter_data[$WOOF->get_swoof_search_slug()]) OR isset($filter_data['min_price'])) AND count($filter_data) > 1) {
unset($filter_data['paged']);
$_GET = $filter_data;
$_REQUEST['perpage'] = -1; //for getting all products ids in WOOF predict filtration
if (isset($filter_data['post_title']) AND!empty($filter_data['post_title'])) {
woot()->filter->provider($filter_data);
}
$WOOF->woof_products_ids_prediction(true);
$ids = $_REQUEST['woof_wp_query_ids'];
if ($ids) {
$args['post__in'] = $ids;
} else {
unset($args['post__in']);
}
}
return $args;
}, 10, 2);
}
}
}
}
return $profile;
}, 10, 3);