Please submit a private ticket if you need to share sensitive information, such as license details and admin credentials.

Okay
  Public Ticket #2406225
Remove button and call up quick view via image and select options button click
Closed

Comments

  • Paul Cox started the conversation

    Hello,

    I am looking to remove the quick view button/link (I can probaly work this out using CSS) but I would like the user to activate the quick view by clicking on the product image and "Select Options" button.

    Is this feature available in your premium plugin?

    Kind Regards

    Paul

  •  767
    Janilyn replied

    Hi Paul, 

    Thank you for contacting WPClever Support Forum. 

    I have transferred your ticket to one of our developers so that he can check if this is possible and give you further info. He’ll be responding to you as soon as he's available for support. 

    Ps:  Can you please provide your site link for our developer to have a look at your site first? 

    Best regards. 

    Janilyn T. - WPClever Support Agent

  • [deleted] replied

    Hi Paul Cox,

    Yes, I can help you this feature, but please upgrade the plugin to premium and give us the paypal ID number. 

  •   Paul Cox replied privately
  •  1,228
    Dustin replied

    Hi Paul,

    Thanks for your purchase!

    Please add below code to current theme (or child-theme) / functions.php

    // remove quick view button
    add_filter( 'woosq_button_position', function () {
        return '0';
    } );
    // remove default link open and close
    remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
    // add quick view link open
    add_action( 'woocommerce_before_shop_loop_item', 'woosq_before_shop_loop_item', 9 );
    function woosq_before_shop_loop_item() {
        global $product;
        echo '<div class="woosq-btn" data-id="' . $product->get_id() . '" style="cursor: pointer">';
    }
    // add quick view link close
    add_action( 'woocommerce_after_shop_loop_item', 'woosq_after_shop_loop_item', 99 );
    function woosq_after_shop_loop_item() {
        echo '</div>';
    }
    // change the add to cart button
    add_filter( 'woocommerce_loop_add_to_cart_link', 'woosq_loop_add_to_cart_link', 99, 2 );
    function woosq_loop_add_to_cart_link( $link, $product ) {
        return '<span class="button">' . esc_html( $product->add_to_cart_text() ) . '</span>';
    }

    If have any difficulties, please send me your website info (wp-admin link, username, password) then I can do that for you. You also can create a dev/staging site with the same issue then I'll work on it.

    Best regards,
    Dustin

  • Paul Cox replied

    Thank you for your reply Frankie,

    This has kind of solved my problem and improved the situation, but it has also created a couple of issues. I removed:

    // change the add to cart button
    add_filter( 'woocommerce_loop_add_to_cart_link', 'woosq_loop_add_to_cart_link', 99, 2 );
    function woosq_loop_add_to_cart_link( $link, $product ) {
        return '<span class="button">' . esc_html( $product->add_to_cart_text() ) . '</span>';
    }
    

    So the add to cart button still adds to the basket.

    However, this button is not functioning as it did before, as the WC Quick view flashes on and off and the items are not added to the cart instantaneously like they did beforehand.

    Also the quantity incremental buttons and number field also call up WC Quick View but I again would like these to function as normal.

    Please visit my website below so you can see:

    https://pmcweb.co.uk/gandhi-cosham/product-category/tandoori/

    On the plus side, the "Select options" button is working as required.

    May be the issue here is that the product image, text, price and variable button need to be assigned the WC Quick View functions individually, rather than the whole loop?

  •  1,228
    Dustin replied

    That means you still want to use the quantity input and add to cart button for simple products? https://prnt.sc/sk6eaz

    I can help you change the code to make it work correctly. 

    Please send me your website info (wp-admin link, username, password) then I can do that for you. You also can create a dev/staging site with the same issue then I'll work on it.

    Best regards,
    Dustin

  • Paul Cox replied

    Hi Frankie, if we could only use this snippet for the coding to resolve the problem (seen in the attachments) then I would be happy to create a staging site.

    Kind Regards

    Paul


  •  1,228
    Dustin replied

    Yes, we can do that!

    Best regards,
    Dustin

  •   Paul Cox replied privately
  •  1,228
    Dustin replied

    I've changed the code for you. Please check again https://pmcweb.co.uk/gandhiclone/product-category/bread-sundries/

    // remove quick view button
    add_filter( 'woosq_button_position', function () {
        return '0';
    } );
    // remove default link open and close
    remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
    // add quick view link open
    add_action( 'woocommerce_before_shop_loop_item', 'woosq_before_shop_loop_item', 9 );
    function woosq_before_shop_loop_item() {
        global $product;
        echo '<div class="woosq-btn" data-id="' . $product->get_id() . '" style="cursor: pointer">';
    }
    // add quick view link close
    add_action( 'woocommerce_after_shop_loop_item', 'woosq_after_shop_loop_item', 5 );
    function woosq_after_shop_loop_item() {
        echo '</div>';
    }
    // change the add to cart button
    add_filter( 'woocommerce_loop_add_to_cart_link', 'woosq_loop_add_to_cart_link', 99, 2 );
    function woosq_loop_add_to_cart_link( $link, $product ) {
        if( $product->is_type('variable') ) {
            return '<span class="button woosq-btn" data-id="' . $product->get_id() . '">' . esc_html( $product->add_to_cart_text() ) . '</span>';
        }
        
        return $link;
    }

    Best regards,
    Dustin

  • Paul Cox replied

    This is fantastic - works exactly how I wished to. I thoroughly appreciate the time you have spent to do this and will happily leave a review.

    I am being a perfectionist now, but I do notice the page scrolls down a little after you close the quick view, is it possible to stop this?

    Also when the "add to cart" button is used in quick view the page reloads after adding to the basket - would it be possible for the item to be added to basket within quick view without reloading the page and just closing the box instead without the page reloading?

  •  1,228
    Dustin replied

    #1. About add to cart, I've installed another plugin from us WPC Ajax Add to Cart for WooCommerce and it works fine now. Please check https://pmcweb.co.uk/gandhiclone/product-category/bread-sundries/

    #2. About the page scroll down, seem it only happen on your website and I need more time to check it.

    Best regards,
    Dustin

  • Paul Cox replied

    Many thanks Frankie. The Ajax plugin works really well to prevent the page from reloading.

    Regarding the scrolling issue, it only does this for the top row of items. If you scroll down to second row or rows after the scroll bar stays in the same position.

    It is odd that it only does this for the first row. Could it be linked to my additional CSS I used to make my body appear under my floating header:

    /*Body realignment */
    body {
            margin-top: 180px;
    }
  •  1,228
    Dustin replied

    I added this snippet for you https://prnt.sc/sn892n

    Please test again https://pmcweb.co.uk/gandhiclone/product-category/bread-sundries/

    add_action( 'wp_footer', 'woosq_footer', 99 );
    function woosq_footer() {
        ?>
        <script type="text/javascript">
            var woosq_top = 0;
            jQuery(document.body).on('woosq_open', function() {
                // save the position when opening
                woosq_top = jQuery(window).scrollTop();
            });
            jQuery(document.body).on('woosq_close', function() {
                // scroll to saved position
                jQuery(window).scrollTop(woosq_top);
            });
        </script>
        <?php
    }

    Best regards,
    Dustin

  • Paul Cox replied

    Thank you Frankie. Everything seems to be working as wished for now, I really appreciate your help.

    Are you able to complete customisable work with other plugins, as separate service? Perhaps you may be able to help me customise a receipt produced by BizSwoop using the plugin 'Order Receipt Print for WooCommerce Google Cloud Print', happy to pay for this service if possible?

    Kind Regards, Paul

  •  1,228
    Dustin replied

    You're welcome!smile.png

    If you are satisfied with our plugin and support, please reward it with a full five-star ★★★★★ rating.
    https://wordpress.org/support/plugin/woo-smart-quick-view/reviews/?filter=5
    Thank you in advance! <3

    ----

    About your question about customization work: Sorry, we don't provide this service now. Thanks for asking!

    Best regards,
    Dustin