Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1373903
    Tristan A
    Participant

    Hi there,

    I am trying to use the code from this thread to hide the Woo cart when empty.

    https://community.theme.co/forums/topic/showhide-ajax-cart/

    It doesn’t seem to work, unfortunately….

    All help appreciated!

    #1373904
    Tristan A
    Participant
    This reply has been marked as private.
    #1374494
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! The code isn’t working because you have a different setting. With you current settings, you should make use of this code instead:

    (function($) {
    
      var element = $('.x-cart .outer');
    
      if(element.html() == "0 Items") {
        $('.x-menu-item-woocommerce').css('display','none');
      } 
    
      element.on('change', function(){
        if(element.html() == "0 Items") {
          $('.x-menu-item-woocommerce').css('display','block');
        }
      });
    
    })(jQuery);

    We would loved to know if this has work for you. Thank you.

    #1374896
    Tristan A
    Participant

    Thanks! It worked!

    #1375056
    Rahul
    Moderator

    Glad to hear it!

    Feel free to ask us again. 🙂

  • <script> jQuery(function($){ $("#no-reply-1373903 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>