• Hello!

    I’m quite interested if that’s possible to do one thing in a simple way.
    I’d like to redirect users to “Product” page while clicking on the fly cart banner if the cart is empty.
    How can I do this?
    In case it’s not empty, I don’t need anything to be changed.

    Thank you for your response! Your Woo plugins are ones of the best.

    • This topic was modified 2 years, 7 months ago by romancr. Reason: Updated

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Henry N

    (@henrynguyen259)

    Try this:

    <script type="text/javascript">    
            (function($) { 
                $(document).ready(function(event){
                    var elm = '.woofc-count';
                    
                    if (woofc_vars.manual_show != '') {
                        elm = woofc_vars.manual_show;
                    }
    
                    $(document).on('click touch', $(elm), function(e) {
    
                        e.preventDefault();
    
                        var counter = $(this).find('.woofc-count-number');
    
                        if( counter.length ) {
                            if( parseInt(counter.html()) == 0 ) {
                                var url = 'https://wpclever.test/shop/';
                                
                                $(this).off('click touch');
                                
                                if( window.location.href !== url ) {
                                    window.location.href = url;
                                }
                            }
                        }
                    });
                });
            })(jQuery);
        </script>
Viewing 1 replies (of 1 total)
  • The topic ‘Redirect to Products when cart is empty’ is closed to new replies.