Compatibility with Elementor
To make filterable woocommerce products generated by Elementor add please next code in file functions.php:
add_action('pre_get_posts', function ($query) {
if (defined('ELEMENTOR_VERSION')) {
if (is_object($query) AND isset($query->query['post_type'])) {
if ($query->query['post_type'] === 'product' /* AND is_page(__YOUR_PAGE_ID__)*/) {
global $WOOF;
if (is_object($WOOF) AND !empty(woof()->get_request_data())) {
woof()->woof_products_ids_prediction(true);
$query->query_vars['post__in'] = $_REQUEST['woof_wp_query_ids'];
}
}
}
}
return $query;
});
Leave code is_page(__YOUR_PAGE_ID__) if you want to use WOOF filtration only on specified page
Also read: Make page builders and custom template filterable
Troubles? Ask for Support!
