Magento 1 - Modify filter labels

I added in_stock filter in Magento 1. It displays like this:

Screenshot-2018-2-19 نوت‌بوک

I want to display Out of stock and In stock instead of 0 and 1 respectively.

How can I do that? I’m using the latest version of Algolia on a Magento


Hello Pedram,

you’ll need to modify that in widget configuration in JavaScript. You can use algoliaHookBeforeWidgetInitialization event and modify the widget there.

Let me know if it works for you.

Thanks for your reply and sorry for my delay.
I checked the link you provided and I did this:

function algoliaHookBeforeWidgetInitialization(allWidgetConfiguration) {
    allWidgetConfiguration.refinementList.forEach(function (elem) {
        if (elem.attributeName == 'in_stock') {
            elem.values = { 'In Stock': 0, 'Out of Stock': 1 };

    return allWidgetConfiguration;

I’m not sure if it is the correct way or not, but I’m sure that it didn’t work. Can you please add some details on how I can achieve this?

Thanks a lot.