Support » Plugin: WooCommerce Cart Stock Reducer » Show Countdown in Mini Cart

  • Hi James – firstly what a great plugin – it’s really nicely executed – many congratulations.

    I’m trying to show the countdown timer in the fly-out mini cart which is part of my main template and have achieved this by adding the script below. However, this only shows in the min-cart on Woo pages. Will the plugin allow this to load on other pages or is it limited to Woo pages only?

    <script src='https://domain.com/wp-content/plugins/woocommerce-cart-stock-reducer/assets/js/jquery-countdown/js/jquery.countdown.min.js?ver=2.0.2' id='wc-csr-jquery-countdown-js'></script>
        <script>
        jQuery( document ).ready(function() {
            jQuery('#%%ELEMENT_ID%%').countdown({until: '+596', format: 'dhmS', layout: '{d<}{dn} {dl} {d>}{h<}{hn} {hl} {h>}{m<}{mn} {ml} {m>}{s<}{sn} {sl}{s>}'});
        });
        </script>
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter cleggerama

    (@cleggerama)

    UPDATE: so a much simpler solution is to just apply the wc-csr-countdown class to a div. But same problem persists with the timer not showing on non-Woo pages. Wonder if there’s a workaround?

    Plugin Author James Golovich

    (@jamesgol)

    You’re definitely venturing into undefined territory here. Do you see any errors in the browser console?

    Thread Starter cleggerama

    (@cleggerama)

    Hi James – no, no errors. The counter just doesn’t show. The counter div isn’t even visible as an element. But when on a Woo page (product, shop, cart, checkout but NOT My Account), the div is there with the counter and all is well.

    Plugin Author James Golovich

    (@jamesgol)

    Do you have this up in a publicly accessible site I could take a quick look at? I feel like I’m missing something here, but I wonder if what you are hard coding in your mini cart is being replaced dynamically?

    Thread Starter cleggerama

    (@cleggerama)

    Hi James, I’ve removed the script and just using the class on the div so it shouldn’t be I don’t think. You can see here.

    Plugin Author James Golovich

    (@jamesgol)

    If you’re just adding the div you will still need to add the countdown javascript in order for the countdown to be included. The plugin includes the javascript when the ‘woocommerce_notice_types’ filter is called, so I’d guess that your theme isn’t doing the normal WooCommerce notice handling on non-woo pages.

    Thread Starter cleggerama

    (@cleggerama)

    Strange, as I mentioned, I’ve removed the script so all I’m doing is adding the wc-csr-info and wc-csr-countdown classes to the div and the counter is showing on the Woo pages in the mini cart but not the other pages.

    Thanks for the ‘woocommerce_notice_types’ filter heads-up. I’ll see what else I can discover.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.