WPSolr logo

WordPress AI Recommendations
- SEO, conversions -

Search

How to configure Algolia search settings to meet your WooCommerce store needs

Published 13 June, 2023
– Last updated 13 June, 2023

Table of Contents

Introduction

As an online store owner, you want your customers to find products quickly and easily. This is where Algolia search comes into play. Algolia is a powerful and fast search engine that can be easily integrated into your WooCommerce store. However, to get the most out of Algolia, you need to configure it to meet your specific needs.

In this post, we will walk you through the steps you need to take to configure Algolia search settings to meet your WooCommerce store needs. We will also include some code with PHP client, embedded in HTML tags.

Configuring Algolia Search Settings

Step 1: Install Algolia for WooCommerce Plugin

The first step in configuring Algolia search settings is installing the Algolia for WooCommerce plugin. This plugin connects your WooCommerce store to Algolia search and can be easily installed from the WordPress repository.

Step 2: Set Up Algolia Account and Index

Once you have installed the Algolia for WooCommerce plugin, the next step is to set up an Algolia account and index. To set up an Algolia account, visit the Algolia website and sign up for a free trial account. Once you have signed up, you can create an index for your WooCommerce store.

Step 3: Configure Search Settings

After you have created an index, the next step is to configure Algolia search settings. To do this, go to the Settings page in your WordPress dashboard and select the Algolia tab. Here, you can configure various settings such as:

Facets: Facets are attributes of your products that customers can use to filter their search results. You can configure the facets in Algolia to match the attributes of your products.

Synonyms: Synonyms are words that have the same meaning as other words. For example, if your store sells shoes, you might want to create synonyms for “sneakers” and “running shoes”. This way, when customers search for these terms, they will get the same results.

Searchable Attributes: Searchable attributes are the attributes of your products that Algolia will use to search for matches. You can configure the searchable attributes to match the attributes of your products.

Ranking: Ranking determines the order in which your products appear in search results. You can configure ranking in Algolia to match your store’s needs.

Step 4: Add Code to Your Theme

Once you have configured Algolia search settings, the final step is to add code to your theme. This code will connect your WooCommerce store to Algolia search and display search results on your site. Here is an example of the code you can use:


$client = Algolia\AlgoliaSearch\SearchClient::create(
                    'YourAppID',
                    'YourAPIKey'
                );
                $index = $client->initIndex('YourIndexName');
                $query = $_GET['s'];
                $params = [
                    'attributesToRetrieve' => [
                        'post_title', 'permalink', 'image', 'post_excerpt', 'categories', 'tags'
                    ],
                    'facetFilters' => [
                        'is_published:true', 'categories:' . intval($shop_id),
                        // 'currency:' . esc_attr( get_woocommerce_currency() )
                    ],
                ];

$results = $index->search($query, $params);

foreach ($results['hits'] as $item) {
    echo $item['post_title'];
    echo $item['permalink'];
}

How WPSOLR Can Help

While Algolia for WooCommerce is a powerful search engine, it can be complicated to set up and configure. This is where WPSOLR comes into play. WPSOLR is a search plugin for WordPress that takes care of all the complicated configuration for you.
With WPSOLR, you can easily integrate Algolia search into your WooCommerce store. WPSOLR also provides powerful search features such as fuzzy search, facet management, and more.

Conclusion

Algolia search is a powerful and fast search engine that can be easily integrated into your WooCommerce store. To get the most out of Algolia, you need to configure it to meet your specific needs. By following the steps outlined in this post and using WPSOLR, you can create a powerful and efficient search engine for your online store.

Related posts ... not powered by WPSOLR 😊

Representation of an iceberg - 90 percent underwater
A search API is the tip of the iceberg

There are many excellent search APIs to start your integration: symbolic (Elasticsearch, Solr, Algolia), semantic (Weaviate, Pinecone, Milvus, Vespa). But in all projects, there is