Archived topic
WooCommerce Search bar in Page Header
1 reply · Started by Lukas on March 29, 2019
Hello,
is it a chance to add WooCommerce search form in Elements > Page Header? Like here?http://prntscr.com/n4mx5d
I had tried add this code to header:
<?php get_product_search_form(); ?>
but didn't work. I also made this custom hook:
add_shortcode( 'woosearch', 'get_product_search_form' );
and use shortcode [woosearch] in page header, but it also didn't work.
Thank you.
Hi there,
Header Elements don't accept PHP, and trying to turn the default woo search form to a shortcode is a nightmare, probably because Woo add it to their premium extensions.
You could use the Widget Shortcodes plugin to generate a shortcode.
Or maybe one of the other search plugins, like this one with Ajax Search: