Support » Plugin: YITH WooCommerce Quick View » quickview only

  • Hi,
    Is it possible to set it as “quickview only” and remove the link to the product page ?
    Which files have to be modified ?

    • This topic was modified 3 years, 4 months ago by bluecat62.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi,
    and thank you for writing in!

    You can achieve this goal by adding the following code snippet to your theme functions.php

    if ( !function_exists( 'yith_wcqv_customization_quick_view_on_product_click' ) ) {
        add_action( 'wp_enqueue_scripts', 'yith_wcqv_customization_quick_view_on_product_click', 99 );
        function yith_wcqv_customization_quick_view_on_product_click() {
            $js = "jQuery( document ).on( 'click', '.woocommerce-loop-product__link', function (e) {
                e.preventDefault();
                jQuery( this ).closest( '.product' ).find( '.yith-wcqv-button' ).trigger( 'click' );
            });";
            wp_add_inline_script( 'yith-wcqv-frontend', $js );
        }
    }

    Please try it and let us know if everything works fine!

    Please note: remember to clear your cache after adding the code snippet.

    • This reply was modified 3 years, 3 months ago by YITHEMES.

    Hi. I had the same question to use quick view only except for 3 products.
    I used the above code snippet and it worked perfectly but is it possible to disable quick view and have the links to single product page for 3 specific products?

    Thanks for your help 🙂

    • This reply was modified 3 years, 2 months ago by ozzinet.
    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    please replace the previous code with the following.

    if ( !function_exists( 'yith_wcqv_customization_quick_view_on_product_click' ) ) {
        add_action( 'wp_enqueue_scripts', 'yith_wcqv_customization_quick_view_on_product_click', 99 );
        function yith_wcqv_customization_quick_view_on_product_click() {
            $js = "jQuery( document ).on( 'click', '.woocommerce-loop-product__link', function (e) {
                var productUrl = jQuery(this).attr('href');
                var productUrlToExclude = ['http://support.test/product/belt/','http://support.test/product/beanie-with-logo/'];
                if( productUrlToExclude.includes(productUrl) == true ) return;
                e.preventDefault();
                jQuery( this ).closest( '.product' ).find( '.yith-wcqv-button' ).trigger( 'click' );
            });";
            wp_add_inline_script( 'yith-wcqv-frontend', $js );
        }
    }

    As you can see in the code I set the variable productUrlToExclude which include the list of products url to exclude.
    Please replace those URL with the ones you want exclude by the fucntions and it shoudl works fine.
    Let me know.

    Thanks so much for coming back to me.
    I tried that code and replaced the urls with ones I want to exclude but it is still going to quick view rather than the single product page.

    I would give you the link to the site but it is under construction and password protected. Is there an email address I can send those details through to you?

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    unfortunately the only way we have to support you is here, in the official forum of the plugin.
    Can you create a staging site to show me?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘quickview only’ is closed to new replies.