Search for Woocommerce

Hello! How can I redo the search in the HEADER to search for products and not posts?

Hello there,

To accomplish it, try doing the below steps, please:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box
;(function($) {

   'use strict'

   $('.search-box__input form.search-form').append('<input type="hidden" name="post_type" value="product"></input>');
   
})(jQuery);
  1. Update
  2. Clear any applied cache.

Regards,
Kharis

1 Like

Sorry, I just saw you…In the mobile version search the posts. Can this be corrected?

Probably your mobile browser has a cache that doesn’t load the new code addition. Try flushing it and reload your site.

https://codex.wordpress.org/I_Make_Changes_and_Nothing_Happens

Regards,
Kharis

Checked on the Android and IPhone. Everywhere cleaned the cache

Deleting the browser cache did not help

Hello, I cleared chache even opened in new mobile browser, still doesnt, work.

www.nufak.sk

Any ideas,
Thank you

As cheched, the search box is already working correctly as seen on the below video recording.

https://drive.google.com/file/d/1zPs1wo8qUe2HXOR1DaTT6iUpAmrXc37a/view?usp=sharing

Have you been able to fix it by yourself?

Stay safe.
Have an excellent day :slight_smile:

Regards,
Kharis
aThemes Support

Hello,

yes, this works perfect on desktop. When you try to search on mobie, it will not show prices, and the whole layout is different. I need to fix it on phone, thank you!

Sorry I know you dont speak slovak, try to look for word “pelech” so you can see what it does and what it does not.

To compare, try to use the other search bar we have in menu.

Thank you for your help

Any answer please?

Thank you

Hello there,

Please share a link to your store as a reply to this thread. So I can test and suggest you the possible solution to suggest.

Stay safe.
Have an excellent day :slight_smile:

Regards,
Kharis
aThemes Support

hello, I did provide link, you tried it on desktop, but problem is on mobile. I also recommended to look for “pelech” to see results. But you never responded.

On mobile search doesnt show prices, etc. You can also try to use our 2nd search field we have in menu. That works just fine, we just wanna use search field built in theme.

Thank you

Hello there,

As checked, I can see the difference. I will flag this to our development team as it requires code changes in the theme’s core.

Stay safe.
Have an excellent day :slight_smile:

Regards,
Kharis
aThemes Support