Skip to main content
Version: next

Algolia

The Algolia extension allows any project to leverage Algolia indices to list and search for products, categories or pages.

Prerequisites

To use this extension, you need an Algolia account to access the dashboard. You'll also need to create an application and to get access the corresponding API keys.

Depending on how the extension is configured (it's flavor), you might also need to install the Algolia Magento module matching your Magento version.

Installation

First, you need to install the @front-commerce/algolia package:

Command to install @front-commerce/algolia
$ pnpm install @front-commerce/algolia

Then to enable the extension, you need to add the Algolia extension definition to your front-commerce.config.ts. When doing that, you need to pass the flavor in which you want to run the extension, the flavor must be one of the following values:

  • magento2: in this flavor, the extension is configured to work with indices created by the Magento2 Algolia module. See the corresponding How-to for more details.
  • magento1: in this flavor, the extension is configured to work with indices created by the Magento1 Algolia module. See the corresponding How-to for more details.
  • standalone: in this flavor, the extension is configured to work on custom indices. This is an advanced behavior. See the corresponding How-to for more details.
Known issue

The Algolia extension definition needs to appear before the one for Magento (1 or 2) in the extensions array.

For instance, in a Magento 2 based project where the Algolia Magento 2 module is installed on Magento side, the front-commerce.config.ts file would be something like:

front-commerce.config.ts for a Magento2 based project
import { defineConfig } from "@front-commerce/core/config";
import themeChocolatine from "@front-commerce/theme-chocolatine";
import magento2 from "@front-commerce/magento2";
import algolia from "@front-commerce/algolia";
import storesConfig from "./app/config/stores";
import cacheConfig from "./app/config/caching";

// depending on your setup, it can also be "magento1" or "standalone"
// see corresponding how-tos
const algoliaFlavor = "magento2";

export default defineConfig({
extensions: [
algolia(algoliaFlavor), // ⚠️ need to be before magento2()
magento2({ storesConfig }),
themeChocolatine(),
],
stores: storesConfig,
cache: cacheConfig,
configuration: {
providers: [],
},
});