HUSKY - Product Filter for WooCommerce

woof_get_filtered_price_query

バージョン2.2.4/1.2.4以降

このフックは他のプラグインとの互換性のために追加されました。

  • ファイル: \classes\helper.php
  • public static 関数 get_filtered_price

パラメーター

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

ソースファイル

classes/helper.php

コード例


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;
});

使用上の注意

  • このコードをテーマの functions.php ファイルまたはカスタムプラグインに追加してください。
  • フックはフィルタリング処理中に適用されます。変更は即座に反映されます。
  • コールバック関数からは常に期待される値の型を返してください。