Algolia searches for unavailable products in my country

I wonder if there is any way or method for not showing the products that I have in my Shopify store which i have set the market for some countries and it should not show the product to users from other countries, for example, I have a product that should only be available in UK and USA but when I use Algolia in my Shopify web store and search for that product and let's say I am in Netherlands it's showing the product and when I click to it to view the product details it shows 404 page not found. If there is any way please let me know, i am using instant commerce for my theme for Shopify and I can't even access the code I just can add a JS snippet. I get the image for the 404 page the fix I tried is using plain JS to get the title for the page not found and change it to Product not available, it changes the text but for example, if the user goes to a page that is not on the website it will give same message "Product unavailable in your country". function updatePageNotFoundText(e) { // Select the title element const titleElement = document.querySelector('.title.'); // Select the paragraph elements with both classes const paragraph404Element = document.querySelector('.paragraph.hi8r512'); const paragraphBelowElement = document.querySelector('.paragraph.hi8r514.'); // Remove the elements if they exist if (paragraph404Element) { paragraph404Element.remove(); } if (paragraphBelowElement) { paragraphBelowElement.remove(); } if (titleElement) { titleElement.textContent = "Product unavailable in your country"; titleElement.style.fontSize = '24px'; } } document.addEventListener('instantLoadPage', updatePageNotFoundText);

Comment (0)

You’ll be in good company