Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to modify the WOOCOMMERCE product search widget in a way that it can contain 3 drop down fields. Now these drop down fields need to be populated with custom attribute values that I've added to each product.

In a pursuit to do this I saw a post: drop down list taxanomy problem

On pasting the code in that post I got the following error. I'm absolutely new to wordpress. Any help will be highly appreciated.

Catchable fatal error: Object of class WP_Error could not be converted to string in C:\wamp\www\sotcnri\wp-content\themes\mystile\product-searchform.php on line 47

Call Stack
10.0015367840{main}(  )..\index.php:0
20.0024371528require( 'C:\wamp\www\sotcnri\wp-blog-header.php' )..\index.php:17
30.489432052608require_once( 'C:\wamp\www\sotcnri\wp-includes\template-loader.php' )..\wp-blog-header.php:16
40.491632067296include( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\template-fullwidth.php' )..\template-loader.php:47
50.640632543096get_footer(  )..\template-fullwidth.php:56
60.640632543472locate_template(  )..\general-template.php:63
70.640832543608load_template(  )..\template.php:383
80.641232577544require_once( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\footer.php' )..\template.php:407
90.642332578432woo_sidebar(  )..\footer.php:39
100.642332578432dynamic_sidebar(  )..\admin-sbm.php:8
(  )..\widgets.php:893
120.642832580896WP_Widget->display_callback(  )..\widgets.php:893
130.642932581296WC_Widget_Product_Search->widget(  )..\widgets.php:182
140.643132583384get_product_search_form(  )..\class-wc-widget-product-search.php:61
150.643432595944require( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\product-searchform.php' )..\woocommerce-template.php:1490
share|improve this question
I found this code in the codex. I read somewhere that since it's a custom taxanomy we need to append pa_ in front of the taxanomy name as wordpress appends it too. So now the below code displays the taxanomy value. Now I'm going to try and put this in "select" html element. $terms = get_terms("pa_country"); $count = count($terms); if ( $count > 0 ){ echo "<ul>"; foreach ( $terms as $term ) { echo "<li>" . $term->name . "</li>"; } echo "</ul>"; } –  Tejas Sep 16 '13 at 10:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.