• Resolved frangoaoalho

    (@frangoaoalho)


    Dear FiboSearch Team, I hope to find you well.

    Please let me know how can I replace the Search History w/ Upselling Suggestions, for example like nike.com.

    or drop a box with suggestions upon a first click.


    Attentively awaiting feedback,



    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Kris

    (@c0nst)

    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

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.