WOOF - WooCommerce Products Filter


Make page builders and custom template filterable

To make custom template compatible with WOOF add next code to the current WordPress child-theme file functions.php:

add_action('pre_get_posts', function ($query) {
    if (is_object($query) AND isset($query->query['post_type'])) {
        if ($query->query['post_type'] === 'product' /* AND is_page(1867) */) {
            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;
});