Hi @frangoaoalho!
Below I present you an example code snippet, which can be used to replace data in localStorage (the place where we save the user search history):
add_action( 'wp_footer', function() { ?>
<script type="text/javascript">
const customPhrases = ["adidas", "nike", "puma"];
// function to replace phrases with yours
function replaceRecentlySearchedPhrases() {
const jsonData = JSON.stringify(customPhrases);
localStorage.setItem('fibosearch_recently_searched_phrases', jsonData);
}
const customProducts = [
{
"post_id": 88,
"value": "Beanie with Logo",
"url": "https://mydomain.com/product/beanie-with-logo/",
"type": "product",
"thumb_html": "<img src=\"https://mydomain.com/wp-content/uploads/2024/05/beanie-with-logo-1-64x64.jpg\" alt=\"Beanie with Logo\" />"
},
{
"post_id": 87,
"value": "T-Shirt with Logo",
"url": "https://mydomain.com/product/t-shirt-with-logo/",
"type": "product",
"thumb_html": "<img src=\"https://mydomain.com/wp-content/uploads/2024/05/t-shirt-with-logo-1-64x64.jpg\" alt=\"T-Shirt with Logo\" />"
}
];
// function to replace products with yours
function replaceRecentlySearchedProducts() {
const jsonData = JSON.stringify(customProducts);
localStorage.setItem('fibosearch_recently_viewed_products', customProducts);
}
replaceRecentlySearchedPhrases();
replaceRecentlySearchedProducts();
</script>
<?php }, 9999 );
Of course, these products can be generated automatically using WordPress/WooCommerce functions, but they require programming skills and can be approached in various ways. Therefore, you will need to implement this functionality yourself.
Regards,
Kris