Hi, in file functions.php, of your storefront child theme, add
/* Remove Storefront Product Search in Header */
add_action( 'init', 'jk_remove_storefront_header_search' );
function jk_remove_storefront_header_search() {
remove_action( 'storefront_header', 'storefront_product_search', 40);
}
/* Add Ajax Search for woocommerce */
function custom_storefront_search() {
if ( storefront_is_woocommerce_activated() ) { ?>
<div class="site-search">
<?php
if( class_exists( 'DGWT_WCAS_Search' ) ) {
echo do_shortcode('[wcas-search-form]');
}
?>
</div>
<?php
}
}
add_action('storefront_header', 'custom_storefront_search', 40);
Hello,
Thanks Carret for your solution. I really appreciate that.
Thanks @carret for snippet. It worked.
Thanks @damian-gora – Plugin is great.
One more thing, I can see autosuggest (Search box) working for Desktop version of site, but it doesn’t work on mobile version of site. Any advice.
Thanks
Hi Team thanks for wonderful plugin this is really useful for customer on site.
I can see autosuggest (Search box) working for Desktop version of site, but it doesn’t work on mobile version of site. Any advice.
Yea, I am also looking for solution for mobile version. Pl advice.
-
This reply was modified 8 years, 9 months ago by
macfan007. Reason: text
Hi,
I found alternative solution. Paste following code into functions.php in your Storefront child theme.
if ( class_exists( 'DGWT_WCAS_Search' ) ) {
if ( ! function_exists( 'storefront_product_search' ) ) {
function storefront_product_search() {
if ( storefront_is_woocommerce_activated() ) { ?>
<div class="site-search">
<?php echo do_shortcode( '[wcas-search-form]' ); ?>
</div>
<?php
}
}
}
add_action( 'wp_footer', 'asfwc_inverse_orientation_on_mobile' );
function asfwc_inverse_orientation_on_mobile() {
?>
<script>
jQuery(window).on('load', function () {
var $footerSearch = jQuery('.storefront-handheld-footer-bar .dgwt-wcas-search-input');
if ($footerSearch.length > 0) {
$footerSearch.dgwtWcasAutocomplete('setOptions', {
orientation: 'top',
forceFixPosition: true
}
);
}
});
</script>
<?php
}
}
More readable: https://gist.github.com/damian-gora/81552a794434f2715aa31ae2751ad8f2