• Resolved joshuaall

    (@joshuaall)


    Hey,

    how to close the search result panel (and details panel) when a product is added via the Add-to-cart Button in the details panel?

    The flying cart plugin we use is set up to open when a new product is added to the cart. However currently the search pane stays open, partially taking precedence over the flying cart:

    Thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Kris

    (@c0nst)

    Hi joshuaall!

    Use this code snippet:

    // Close FiboSearch after added_to_cart event
    add_action( 'wp_footer', function() { ?>
    	<script type="text/javascript">
    		jQuery(document).ready(function($) {
    			$(document.body).on('added_to_cart', function(event, fragments, cart_hash, $button) {
    				setTimeout(function() {
    					$('.dgwt-wcas-search-input').data('autocomplete').close();
    				}, 300);
    			});
    		});
    	</script>
    <?php }, 9999 );
    

    You have two ways to add this code to your theme:

    1. Open the functions.php in your child theme and add the code at the end.
    2. or install the Code Snippets plugin and apply this code as a snippet.

    Regards,
    Kris

    Thread Starter joshuaall

    (@joshuaall)

    Hey Kris,

    thank you so much! Works like a charm ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Close search pane when adding product to cart’ is closed to new replies.