Woocommerce - Get variable attributes values in instantsearch results

Hi everyone,

We are looking to display some of our product’s variable attributes in search results.

For example if we have a chair with color and size attributes, we would like to show “Size / Color” in the product box.

Is it possible ?

Thank you.

1 Like

In order to customize the display, and as of today, the only solution is to directly edit the instanstsearch template shipped with the plugin: https://github.com/algolia/algoliasearch-woocommerce/blob/master/templates/woocommerce-instantsearch.php

Let us know how that goes,

Best,

Hello,

Thank you for your answer. Displaying the values in the instantsearch template isn’t the problem, but the way to fetch the variable attribute names in this template is.

How can we fetch these values in Algolia’s loop ?

Thank you.

Hello,

I come back to you on this topic. Is it possible to fetch product attribute values in Algolia’s loop ?

Thank you.

Hi Thibault,

Just to clarify for people finding this topic later, with InstantSearch, you can only access the data that was indexed in Algolia in the first place, it doesn’t communicate with your database.

You can fetch any attribute that was indexed. Everything you can see in your Algolia dashboard is retrieved by instantsearch. If you want to use an attribute that is not indexed by default, you’ll have to index them first.

We have a tutorial to help index custom attribute, you should only have to modify a few lines to retrieve the correct data from WordPress: https://community.algolia.com/wordpress/custom-attributes.html

Please let me know if that help.