HUSKY - Product Filter for WooCommerce

woof_set_shortcode_taxonomyattr_behaviour

This hook works in index.php of the plugin in public function woof_shortcode and manipulates the ‘additional_taxes‘ attribute.

Parameters

$taxonomies_string (string) — the taxonomies string from the shortcode attribute

Source File

index.php

Code Example


add_filter('woof_set_shortcode_taxonomyattr_behaviour', function($taxonomies_string) {
    // Force specific taxonomy to always be included
    $additional = 'product_tag:featured,on_sale';
    if (!empty($taxonomies_string)) {
        $taxonomies_string .= '+' . $additional;
    } else {
        $taxonomies_string = $additional;
    }
    return $taxonomies_string;
});

Usage Notes

  • Add this code to your theme's functions.php file or a custom plugin.
  • The hook is applied during the filtering process — changes take effect immediately.
  • Always return the expected value type from the callback function.