• Hello,

    upon typing product names in the search bar, the previews just show blog entries, no products at all. We had a testing environment that showed actual products in the search suggestion – on our productive Stage it just comes up with the blog posts.
    We do not use any search-plugin.
    How can I set up WordPress (or Woocommerce) so that the customer sees products while typing in the search bar? It worked once, I don’t have a clue whats blocking it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    How did you set it up initially? Was it a theme or plugin you used?

    Thread Starter ruben7777

    (@r00b3n)

    Initially, the shop was being maintenanced and set-up by an agency. We use the enfold-Theme. I have never set up anything related to the search or search suggestions. I can only tell that right now, none of the products are being displayed while typing in the search bar, only the blog posts are shown as a suggestion.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you show us the page with the search bar? We can then get a sense of where the problem is coming from.

    Thread Starter ruben7777

    (@r00b3n)

    Allright, this is the page

    suessigkeiten-shop.com

    You can enter anything in the search bar, I think it always shows the blog posts.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    This could be related; there is a JavaScript error on your page here:

    
    
    <script data-cfasync='false' type='text/javascript'>
         (function($) { if ( $( '.gtm4wp_productdata' ).length > 0 ) { for( var i=0; i<dataLayer.length; i++ ) { if ( dataLayer[ i ][ 'ecomm_prodid' ] ) { break; } } if ( i == dataLayer.length ) { // no existing dyn remarketing data found in the datalayer i = 0; dataLayer[ i ][ 'ecomm_prodid' ] = []; } if ( typeof dataLayer[ i ][ 'ecomm_prodid' ].push == 'undefined' ) { return false; } var productdata; $( '.gtm4wp_productdata' ).each( function() { productdata = jQuery( this ); dataLayer[ i ][ 'ecomm_prodid' ].push( '' + productdata.data( 'gtm4wp_product_id' ) ); }); } })(jQuery);
    </script>
    

    It looks like the problem is caused when something has minified the JavaScript.

    Try deactivating all of your plugins to explore whether any could be responsible.

    Thread Starter ruben7777

    (@r00b3n)

    Thanks – i will investigate more. Could it be due to the use of any performance-plugins? Will disabling them restore the original code?

    EDIT:
    There was a plugin active that minifies scripts. But even after disabling said plugin, the script apperently doesnt work.

    • This reply was modified 6 years, 4 months ago by ruben7777.
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Okay the error went away but as you know your problem persists.
    You’re now getting 403 errors:

    
    https://suessigkeiten-shop.com/wp-admin/admin-ajax.php 403 (Forbidden)
    

    Which is coming from your theme’s avia.js script:

    
    https://suessigkeiten-shop.com/wp-content/themes/enfold/js/avia.js?x48273&ver=4.2
    

    On line 2140:

    
    $.ajax({
    				url: avia_framework_globals.ajaxurl,
    				type: "POST",
    				data:values,
    				beforeSend: function()
    				{
    					loading.insertAfter(currentField);
    				},
    				success: function(response)
    				{
    				    if(response == 0) response = "";
                        results.html(response);
    				},
    				complete: function()
    				{
    				    loading.remove();
    				}
    			});
    

    Looks like the theme’s code is correct, but for some reason your server is rejecting access to the admin-ajax.php file

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Search suggestions don’t show products’ is closed to new replies.