Product listing

For example, if a product belongs to categories with IDs: 123, 456, and 987, the attribute in the data should look like this: "category_id": "123, 456, 987".

On the category page, the category ID must be available as well. This ID can be stored in a <meta> tag, set as a cookie, or saved in a JavaScript variable.

Next, configure the Product Listing Filter during search initialization. You can do this in the "initialize" section:

  1. Go to the Search setup.

  2. Navigate to the "2. Appearance and Display" tab.

  3. In the "Custom code" section, click on "initialize(settings)".

Please review the provided code example, where the data includes an attribute with category IDs called "category_id", and the website contains a meta tag on each category subpage with the ID of that category. <meta name="lbCategoryId" content="123">

  • In the first line, create a condition to verify that the user is not on the search page (i.e., no search query parameter exists) and is on a category page (in this case, indicated by information in the URL).

  • Then, in the initialization, wait for the meta tag containing the ID of the user’s current category.

  • Set the IntentFilters and ProductListingFilter to match as follows: "category ID attribute in data" : "ID from the meta tag."

Please copy the provided code into your setup and adjust the condition and attributes as needed.