Back to Documentation

Ajax Search by shortcode

Add a StoreCustomizer Ajax Search anywhere on your site using a shortcode


You are also able to add the StoreCustomizer Ajax Search to and page or widget area using a shortcode.

Ajax Search Shortcode:

[woocustomizer_ajax_search]

This shortcode will display the StoreCustomizer Ajax Search as it’s been set up in the WordPress Customizer, it also offers some extra attributes to further adjust the search to be slightly different:

args:

min_chars="4"

This attribute will allow you to change the amount of characters typed before the ajax search will start showing results.

If not set, then the character amount will fallback to the amount set in the WordPress Customizer.

[woocustomizer_ajax_search] : setting the characters amount for ajax search

placeholder="Custom Text"

Using the ‘placeholder’ attribute you can change the placeholder text that is displayed in the search bar.

If not set, then the placeholder text will fallback to the text set in the WordPress Customizer.

[woocustomizer_ajax_search] : setting the text in the ajax search bar

button="0"

This attribute only accepts 1 (true) or 0 (false) values, where 1 is the default value.

1 = “true” which will display the Ajax Search button.

0 = “false” which will remove the Search button, then the user can simply press enter to execute the search.

If not set, then the button will show by default.

[woocustomizer_ajax_search] : turn the button on or off

button_text="Go"

This attribute will allow you to change the text that is displayed in the button of the Ajax Search.

If not set, then the character amount will fallback to the text set in the Customizer settings.

[woocustomizer_ajax_search] : setting the button text attribute