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

    (@yithemes)

    Hi there,
    do you want show the quick view button only for 3 specific products?
    Please send me additional informations, I see that you have another post already opened about a similar question.

    Thread Starter ozzinet

    (@ozzinet)

    Hi,

    Sorry I thought it might be better to have my own post rather than keep hijacking the other one. ??

    Basically what I need to do is use Quick View for all products except 3. So I need to remove Quick View altogether for those 3 products but on the remainder of the products use Quick View only.

    Hope that makes sense. Thanks so much for your help with this.

    Cheers
    Kate

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    ok, if I’m understanding fine, you want deny the access to the product page for all products (visible only quick view) except three products.
    For these three products do you want hide quick view button?
    I’m asking only to be sure to work in the right way. ??

    Thread Starter ozzinet

    (@ozzinet)

    Hi ??

    Yes that is exactly what I want to do and yes I do want to hide the quick view button for those 3 products. ??

    Thanks for your help

    Cheers
    Kate

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    use following code to apply quick view on all products and deny to access to product page.
    Replace in the code my url of example with url of the products you want exclude from this function.
    I tried with Twenty Sixteen it works.

    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 = ['https://support.test/product/belt/','https://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 );
        }
    }

    Regarding the possibility to hide the quick view button for three specific products, we’ll release next week an update that include a filter which allow to do it.
    After you’ll have update the plugin, please add following code inthe file functions.php of your theme, replacing my ID of example with the ID of the products for which you want hide quick view button.

    add_filter('yith_wcqv_show_quick_view_button','yith_hide_quick_view_button', 10, 2);
    
    function yith_hide_quick_view_button( $show,$product_id ){
        $products_to_exclude = array( 15,31 );
        if( in_array( $product_id, $products_to_exclude ) )
            $show = false;
        return $show;
    }

    Hope to be helpful for you.

    Thread Starter ozzinet

    (@ozzinet)

    Thank you so much! It worked perfectly ??

    This is one of the best support forums ever.

    Cheers
    Kate

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,

    Thanks to you for your patience and cooperation. If you like our support and our plugins, please write to us a good review ??
    Cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Quick view only except for 3 products’ is closed to new replies.