If you want Divi to search ONLY products, you are in the right place. We know how frustrating it is that Divi does not search the products but searches everything. This is not great for your customers UX so the snippet below will solve this for you.
Add this code to Divi > Theme Options > Integration > Body.
Once added, some code will by dynamically added which will make the search bar in the header and all the search modules search products only.
We hope this helps you and any questions please ask.
If using the theme builder and adding the search module, please exclude pages and posts as seen below
How can I make this work so it brings up results by product category (from Woocommerce) please?
Sorry this snippet does not do this. Maybe using a plugin like https://wordpress.org/plugins/relevanssi/ might work.
Hi there… I added the same code on another site I built last year and worked great.
But this time is not showing any product on a new site I’m building for a new client. I checked all the setups between both pages and look the same. Any help?
This is the site: https://www.opticentroxpress.com/
It seems you are using the theme builder and the search module has the hidden fields to search posts. Our tutorial above was used before the theme builder so was only for the default header.
I will check this and see if we can update for the theme builder too
I have updated the article – please check
Hi, there… thank you for the update.
Still no results. I’m gonna hide the search bar meanwhile.
oh ok. If you want me to check, please show it so I can check your website
Hi, same problem here.. It does not work with search module, in my case it adds “&et_pb_searchform_submit=et_search_proccess” to URL and it loses its functionality 🙁
Results page URL is: mydomain.com/?s=xsearchtermx&et_pb_searchform_submit=et_search_proccess&post_type=product
Any possible solution?
Worked perfectly to get the default search to search only Woo products! Thanks!
Thank you so much!
Great, but how do we make this search Products Titles and Product Categories Only
This would require more custom code – sorry.
There are plugins like relevanssi that could possibly help
hello, do i need a plugin from you guys to use the code?
No, this will work with default Divi + Woo
Thanks for the code! Seems to work for a side bar search but not for my divi search in the header. I am using the theme builder for my header. Could this be an issue?
Not sure, should work – can you send a link to your site so I can see?
Is there a way to sort the search by ” Price high to low”?
Love this code.
Good Job
You could but not related to this tutorial – sorry. If you are using our plugin BodyCommerce you can make it sort by this, so when they search it will be like this
Thank you very much, yes it worked
Great thank you!
sadly it does not work…
Does this code still work? I’ve tried it on a new Divi/Woo site without success.
It’s just what I need, especially if it can cause the search box to search SKU values.
Yes it still works – I actually did this on a customers site the other day.
Send me a link to your site so I can see?
Hugely appreciated this! I did add some additional code so people knew the search fields were meant for searching products. Changed the placeholder text to “Search product …” Check it out at Lous Barber Supply.
Nice! So glad it helped you
Thank you so much, it worked perfectly for my site. Is there any chance to change the results display from 5 products to lets say 16 products?
You can change this in Divi > Theme Options 😀
Will this code help change the layout? At this moment the search results layout is like a blog/post. We would like to change it to have 3-4 products per row. https://valuepaw.com/?s=Collar
No, you can use our plugin Divi BodyCommerce to help you if you want to do this
Hi, i don’t see the snippet!! could you send me please?
See here: https://gist.github.com/diviengine/02d0601d33826c309c5e7ccbaf1d4c7d#file-divi-product-search-js
It dint work for me either.
any ideas, what must have gone wrong?
Not sure – please check the other comment about the Divi search module
This is not working for me.. I have ensured to add the code snipped to the body but still nothing. Any advice?
Very cool indeed, works well! Thank you.
Pleasure, glad it worked
This worked extremely well and was exactly what I needed. Thank you! Anychance we can add to this and make the code also consider product tags as well? Again, thanks for the fantastic work.
There would be more code needed for this. I would suggest using a plugin like https://wordpress.org/plugins/relevanssi/ to help with this
Hi, thank you for your content. If I instaled relevanssi, will it work with divi search module? I tried once before finding this post but nothing changed.
I have personally used this plugin and worked well for me
This is amazing – just what I was looking for, and it works like a treat! Thank you so much.
Perfect thanks – glad it helped you 😀
Hi… This did not work form me
Any ideas on what is wrong??
For the moment I have disabled the Divi Search and I´m Currently using AWS, but it displays on-screen and doesn’t send to the Search Result Page Created and Asigned in Divi.
Cheers,
Maybe there is a javascript error on your website which makes this code not run.
Can you send me a link to your site with Divi Search enabled (you can use CSS to hide it if you want) – I need to see if the hidden input gets added