play sound when new order arrives (admin)

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
  • #4024
    Admin & Mod

    Note by admin: the below is completely irrelevant with WPPizza v3.x+ – as it’s inbuilt as an option – and only here for historical reasons (i.e if still using WPPizza 2.x)

    if you are too busy to look at your emails/order history all the time, you could also play a sound when a new order arrives if you like that sort of thing … (put it in your theme’s functions.php)

            play sound on new order in order history.
            repeats every 5 sec (5000 ms) until there's no
            new order anymore (just change the status)....
            set timeout (5000) to whatever timeinterval is required
            set soundfile (notifySound):  URL to whatever sound is supposed to be played
            if using IE, use an mp3 file instead of .wav
        add_action('admin_footer', 'wppizza_notify_new_orders');
        function wppizza_notify_new_orders(){
            global $current_screen;
            if(isset($current_screen) && $current_screen->id=='wppizza_page_wppizza-order-history'){
            echo"<script type='text/javascript'>
                /* <![CDATA[ */
                        var notifySound = '".get_template_directory_uri()."/notify.wav';/*  URL to your soundfile */
                        var notifyNewOrders = new Audio(notifySound);
                        var notifyNewOrdersInterval=setInterval(function(){
                /* ]]> */

    Perfect. Thanks


    Great this is working, BUT if I make 5000ms the full song is playing AND is it possible not to repeat the song?

    Thank you very much

    Admin & Mod

    you are playing a whole song ? are you insane (meaning that in the nicest possible way 🙂 ?
    sounds like cacophony
    then again, this might be interesting though…maybe there’s an artform to be discovered 😉

    in any case, you will have to set the settings (timeout etc) according to your soundfiles

    the above is an example, it’s up to you to adjust

    Admin & Mod

    essentially , use a short soundfile.

    if you change the status , it should not play again (unless of course there’s another order that justifies this soundfile being played again)

    again – it’s a sample code/codesnippet. it’s for you to make this work for your situation

    River Taylor

    Where do we put this little piece of code?

    Admin & Mod

    (put it in your functions.php)


    This is a great option, but I’m having difficulty getting it to work. I have added this code into the template functions.php and uploaded a sound file – notify.mp3 – using the media library. Have I placed the sound file in the right place?

    Admin & Mod

    get_template_directory_uri() refers to your theme directory, either change that code to point to your uploads, or upload the sound file to your theme’s directory
    (note: look at the source of your page to see where it points to…..)


    Thanks, heaps. Working like a dream.

    Michael Maccar

    Hi Olly
    I’ve been having email delays with my email server lately so I’m trying this code but looks like I’m not using the code right. I’ve put the code in my theme’s functions.php
    and moved the notify.wav to theme directory .. still dose not work

    do I need to point it to the link like this or something ?
    var notifySound = ‘”.get_template_directory_uri(”/notify.wav’;

    Thanks for your help

    Admin & Mod

    sorry, but I know nothing about your server/setup.
    you will have to adjust the code as needed in your environment. I cannot help you more than what is already said in this thread or the code provided.

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘play sound when new order arrives (admin)’ is closed to new replies.