Make the default Divi search box search WooCommerce products only

If you have a Divi/WooCommerce site and you don’t have any posts, this is perfect for you. The default Divi search will now search only your products. You can add this to the Divi theme options Integration tab in the head. Or add to a Code module in your global header. This also changes the placeholder text from “Search” to “Search Products”. For example when you click on the search icon like below. change-search-products It will show this: change-search-products2 Make sure you put the code inside a script tag.
jQuery(document).ready(function($){ // wait for jQuery to load
  $(".et-search-form").append(''); // dynamically add the input below the search box that tells the search that the post type to search are products.
  $(".et_pb_menu__search-form").each(function() { // now for each search box from the Divi module
  $(this).append(''); // add that input there too
// change placeholder text on default Divi search box
window.onload = function() {
let searchinput = document.getElementsByClassName('et_pb_menu__search-input')[0];
searchinput.placeholder = "Search Products";


Submit a Comment

Your email address will not be published. Required fields are marked *

More Tips

Ad - Web Hosting from SiteGround - Crafted for easy site management. Click to learn more.

Cloudways Hosting

WPEngine Hosting

Pressable Hosting

AccuWeb Hosting

Ask the Divi Guy a Question

"*" indicates required fields