HUSKY - Product Filter for WooCommerce

woof_get_filtered_price_query

Dalla versione 2.2.4/1.2.4

Questo hook è aggiunto per compatibilità con altri plugin.

  • file: \classes\helper.php
  • public static function get_filtered_price

Parametri

$sql (string) — the SQL query used to select prices

File sorgente

classes/helper.php

Esempio di codice


add_filter('woof_get_filtered_price_query', function($sql) {
    // Modify the price range SQL query
    // For example, to exclude certain product types from price calculation
    global $wpdb;
    $sql .= " AND {$wpdb->posts}.post_type NOT IN ('excluded_type')";
    return $sql;
});

Note per l'utilizzo

  • Aggiungi questo codice al file functions.php del tuo tema o a un plugin personalizzato.
  • L'hook viene applicato durante il processo di filtraggio — le modifiche hanno effetto immediatamente.
  • Restituisci sempre il tipo di valore previsto dalla funzione di callback.