woof_husky_txt_option
Filters each rendered HTML option in the Husky text search autocomplete dropdown, allowing customization of individual search result items.
Parameters
$html (string) — The rendered HTML string for a single search result option from the template
$data (array) — Associative array of product data including: id, title, permalink, thumbnail, excerpt, breadcrumb, labels, and options
Source File
ext/by_text/index.php:1066
Code Example
add_filter('woof_husky_txt_option', function($html, $data) {
// Add a price badge to each result
$product = wc_get_product($data['id']);
if ($product) {
$price = wc_price($product->get_price());
$html = str_replace('</a>', '</a> <span class="price-badge">' . $price . '</span>', $html);
}
return $html;
}, 10, 2);
Usage Notes
- Only fires when a valid template path exists.
- The $data array contains click_target (how_to_open_links), options, and product metadata.
- Part of the 'by_text' extension's Husky search feature.