FiboSearch Ajax Search for WooCommerce Shortcode

Below, you’ll find a detailed guide on how to add the FiboSearch – Ajax Search for WooCommerce Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the FiboSearch – Ajax Search for WooCommerce Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the FiboSearch – Ajax Search for WooCommerce Plugin and the shortcodes it provides:

Plugin Icon
FiboSearch – Ajax Search for WooCommerce

"FiboSearch – Ajax Search for WooCommerce is a dynamic plugin that enhances your eCommerce site's search functionality. It offers real-time product search results, improving user experience."

★★★★☆ (1574) Active Installs: 100000+ Tested with: 6.3.2 PHP Version: 7.0
Included Shortcodes:
  • [wcas-search-form]

FiboSearch [wcas-search-form] Shortcode

The ‘wcas-search-form’ shortcode is a powerful feature of the Ajax-Search-For-WooCommerce plugin. It generates a customizable search form for your WooCommerce store. This shortcode allows you to define class, style, icon, layout, mobile settings, background, submit button, and icon color. It integrates with WooCommerce and applies filters to enhance search functionality.

Shortcode: [wcas-search-form]

Parameters

Here is a list of all possible wcas-search-form shortcode parameters and attributes:

  • class – Assigns additional CSS classes to the search form.
  • style – Determines the style for the search form from layout settings.
  • icon – Chooses an icon for the search form from layout settings.
  • layout – Sets the layout of the search form from layout settings.
  • layout_breakpoint – Defines the breakpoint for the layout change.
  • mobile_overlay – Activates the mobile overlay feature from layout settings.
  • mobile_overlay_breakpoint – Sets the breakpoint for the mobile overlay feature.
  • darken_bg – Darkens the background of the search form from layout settings.
  • submit_btn – Enables or disables the submission button.
  • submit_text – Sets the text for the submission button.
  • icon_color – Changes the color of the search form icon.

Examples and Usage

Basic example – A simple usage of the shortcode to add the WooCommerce search form to a post or page.

[wcas-search-form /]

Advanced examples

Using the shortcode to add a WooCommerce search form with a specific style and icon. The style parameter controls the appearance of the search form, and the icon parameter specifies the icon to use for the search button.

[wcas-search-form style="minimal" icon="search" /]

Using the shortcode to add a WooCommerce search form with a specific layout and mobile overlay. The layout parameter controls the arrangement of the search form elements, and the mobile_overlay parameter specifies whether to use an overlay for mobile devices.

[wcas-search-form layout="classic" mobile_overlay="yes" /]

Using the shortcode to add a WooCommerce search form with custom submit button text and icon color. The submit_text parameter sets the text for the submit button, and the icon_color parameter sets the color for the search icon.

[wcas-search-form submit_text="Go" icon_color="#ff0000" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [wcas-search-form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'wcas-search-form', array( __CLASS__, 'addBody' ) );

Shortcode PHP function:

function addBody( $atts, $content, $tag )
    {
        $layout = Helpers::getLayoutSettings();
        $searchArgs = shortcode_atts( array(
            'class'                     => '',
            'style'                     => $layout->style,
            'icon'                      => $layout->icon,
            'layout'                    => $layout->layout,
            'layout_breakpoint'         => '',
            'mobile_overlay'            => $layout->mobile_overlay,
            'mobile_overlay_breakpoint' => '',
            'darken_bg'                 => $layout->darken_background,
            'submit_btn'                => null,
            'submit_text'               => null,
            'icon_color'                => '',
        ), $atts, $tag );
        $searchArgs['class'] .= ( empty($searchArgs['class']) ? 'woocommerce' : ' woocommerce' );
        $args = apply_filters( 'dgwt/wcas/shortcode/args', $searchArgs );
        return self::getForm( $args );
    }

Code file location:

ajax-search-for-woocommerce/ajax-search-for-woocommerce/includes/Shortcode.php

Conclusion

Now that you’ve learned how to embed the FiboSearch – Ajax Search for WooCommerce Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

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