HUSKY - Product Filter for WooCommerce

Rendi filtrabili le griglie prodotti di Elementor (snippet pre_get_posts)

Per rendere filtrabili i prodotti WooCommerce generati da Elementor, aggiungi il seguente codice nel 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;
});

Lascia il codice is_page(__YOUR_PAGE_ID__) se desideri utilizzare la filtrazione WOOF solo sulla pagina specificata

Leggi anche: Rendi filtrabili i page builder e i template personalizzati