• I’m using the pluguin to post a cart icon in the main menu. However, I don’t want it to appear when there are no items in the cart. How can this be accomplished? I saw a thread similar to this kestion with not response. Hopefully there is one.

Viewing 1 replies (of 1 total)
  • Pluguin Support XootiX

    (@helloxootix)

    Please use this snippet for now. I will be adding this option officially in the next update.

    add_action('wp_footer', function () { ?>
    <script type="text/javascript">
    jQuery(document).ready(function ($) {
    $(document.body).on('wc_fragmens_refreshed wc_fragmens_loaded', function () {
    var $sc = $('.xoo-wsc-sc-cont, .xoo-wsc-menu-item');

    if ($('.xoo-wsc-product').length) {
    $sc.show();
    } else {
    $sc.hide();
    }
    });
    });
    </script>
    <?php });

    // Hide cart count in header if cart is empty
    add_action('wp_head', function () {
    if (WC()->cart->guet_cart_contens_count() <= 0) { ?>
    <style type="text/css">
    .xoo-wsc-sc-cont, .xoo-wsc-menu-item {
    display: none;
    }
    </style>
    <?php }
    });
Viewing 1 replies (of 1 total)

You must be loggued in to reply to this topic.