• melania525

    (@melania525)


    hi i try to trigger yith quick view button by this code

    add_action("wp_footer", "trigger_click_wrapper");
    
    function trigger_click_wrapper()
    {
        ?>
    
        <script type="text/javascript">
            
    
            jQuery(document).ready(function()
    
            {
    
                      jQuery(document).on('click', '.product-content' , function(e)
                      { 
                        jQuery(this).find('.what to add here?').trigger('click');
    
                      });
    
            });
        </script>
        <?php
    }

    I tried many classes without affect.
    What class should i add for trigger your plugin?

    Thanks a lot

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi,
    and thank you for writing in!

    The Quick View button class is yith-wcqv-button, so you could use the .yith-wcqv-button selector.
    Please try adding the following code snippet to your theme functions.php

    if ( !function_exists( 'yith_wcqv_customization_trigger_quick_view_on_product_click' ) ) {
    	add_action( 'wp_enqueue_scripts', 'yith_wcqv_customization_trigger_quick_view_on_product_click', 99 );
    	function yith_wcqv_customization_trigger_quick_view_on_product_click() {
    
    		$js = "( function( $ ){
    				$( document ).on( 'click', '.product-content', function (e) {
    					e.preventDefault();
    					
    					var btn = $(this).find( '.yith-wcqv-button' );
    					if ( !btn.length ){
    						btn = $(this).closest( '.product' ).find( '.yith-wcqv-button' );
    					}
    					
    					if ( !btn.length ){
    						return;
    					}
    					
    					btn.trigger( 'click' );
    				});
            } )( jQuery );";
    		wp_add_inline_script( 'yith-wcqv-frontend', $js );
    	}
    }

    and let us know if this will do the trick!

    Thread Starter melania525

    (@melania525)

    Hi and thanks for your reply. I added this but on click it doesnt do anything and i get a high server load. I work on deticated server

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Trigger yith quick view’ is closed to new replies.