Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stoffl6781/230eb56aef9479b8bfd7fcbace14bf4e to your computer and use it in GitHub Desktop.
Save stoffl6781/230eb56aef9479b8bfd7fcbace14bf4e to your computer and use it in GitHub Desktop.
add_filter( 'get_product_search_form' , 'me_custom_product_searchform' );
/**
* Filter WooCommerce Search Field
*
*/
function me_custom_product_searchform( $form ) {
$form = '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/' ) ) . '">
<div>
<label class="screen-reader-text" for="s">' . __( 'Search for:', 'woocommerce' ) . '</label>
<input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'My Search form', 'woocommerce' ) . '" />
<input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search', 'woocommerce' ) .'" />
<input type="hidden" name="post_type" value="product" />
</div>
</form>';
return $form;
}
@stoffl6781
Copy link
Author

How to translate the placeholder "search for Products..." Placeholder in WooCommerce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment