
canitbedone(@canitbedone)
15 Posts
Customers
Quote from canitbedone on June 1, 2022, 14:49
Hi is it possible to rename a product category inside the filter menu?
For example in the image below, how can I rename the last category to read "Child Category with custom text"?

Is this possible?
Thank you
Hi is it possible to rename a product category inside the filter menu?
For example in the image below, how can I rename the last category to read"Child Category with custom text"?

Is this possible?
Thank you

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on June 2, 2022, 10:39
Hello
Unfortunately, the plugin does not have such a feature, you need code customization.
Use this hook to find an rename this term - https://products-filter.com/hook/woof_sort_terms_before_out
Hello
Unfortunately, the plugin does not have such a feature, you need code customization.
Use this hook to find an rename this term - https://products-filter.com/hook/woof_sort_terms_before_out

canitbedone(@canitbedone)
15 PostsTopic Author
Customers
Quote from canitbedone on June 3, 2022, 00:51
Hi I found some code that uses woof_sort_terms_before_out but it only shows the categories I add to the array which I don't want to do as there's lots of categories and only 2 need to be renamed. Also I am not sure how to rename them within this PHP snippet. Please can you advise if possible?
Would it be possible to echo all the categories out by default and if category ID 1019 found then change the text to Test 123 and if category ID = 1697 found change text to Test 456?
add_filter('woof_sort_terms_before_out', function($terms,$type){
$new_terms=array();
foreach($terms as $term){
if($term['taxonomy']=="product_cat" AND in_array($term['term_id'],array(1019,1697))){
$new_terms[]=$term;
}
}
if($new_terms) {
return $new_terms;
}
},99,2);
Hi I found some code that uses woof_sort_terms_before_out but it only shows the categories I add to the array which I don't want to do as there's lots of categories and only 2 need to be renamed. Also I am not sure how to rename them within this PHP snippet. Please can you advise if possible?
Would it be possible to echo all the categories out by default and if category ID 1019 found then change the text to Test 123 and if category ID = 1697 found change text to Test 456?
add_filter('woof_sort_terms_before_out', function($terms,$type){
$new_terms=array();
foreach($terms as $term){
if($term['taxonomy']=="product_cat" AND in_array($term['term_id'],array(1019,1697))){
$new_terms[]=$term;
}
}
if($new_terms) {
return $new_terms;
}
},99,2);

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on June 3, 2022, 12:56
Hello
An example:
add_filter('woof_sort_terms_before_out', function($terms,$type){
$new_terms=array();
foreach($terms as $key => $term){
if($term['taxonomy']=="product_cat" AND in_array($term['term_id'],array(1019,1697))){
if ($term['term_id'] == 1019) {
$terms[$key ]['name'] = "Test 123";
}
if ($term['term_id'] == 1697) {
$terms[$key ]['name'] = "Test 456";
}
}
}
return $terms;
},99,2);
Hello
An example:
add_filter('woof_sort_terms_before_out', function($terms,$type){
$new_terms=array();
foreach($terms as $key => $term){
if($term['taxonomy']=="product_cat" AND in_array($term['term_id'],array(1019,1697))){
if ($term['term_id'] == 1019) {
$terms[$key ]['name'] ="Test 123";
}
if ($term['term_id'] == 1697) {
$terms[$key ]['name'] ="Test 456";
}
}
}
return $terms;
},99,2);

canitbedone(@canitbedone)
15 PostsTopic Author
Customers
Quote from canitbedone on June 3, 2022, 14:11
Wow great stuff! That works perfectly! Thanks so much!!
Wow great stuff! That works perfectly! Thanks so much!!

Pablo Borysenco(@pavlo_borysenco)
34,196 Posts
Quote from Pablo Borysenco on June 6, 2022, 11:31
Hello
Welcome;)
Hello
Welcome;)