Automatically send invoices upon incoming orders This script checks for incoming orders and opens a new window with the invoice when an order comes in. The invoice is then sent automatically via email to the customer. 1. On EasyWebshop, at Settings > More options > Invoice & Tax > Automated actions, enable Assign invoice number & Email invoice. 2. Install a browser add-on that allows you to inject JavaScript code into a web page. In Firefox you can use "Website scripting" by Anbarasan. 3. Add a new script. Name: Send invoice automatically. URL: https://easywebshop.com/software/order(.*) 4. Insert the JavaScript code below. Notes: - Leave the browser window open at https://easywebshop.com/software/order - The script checks every 10 seconds (10000 milliseconds), this can be lowered if there are a lot of incoming orders The JavaScript code: // This script automatically sends the invoice on incoming order // Check for incoming order function checkIncomingOrder() { if (document.getElementById('ssenotif') !== null && document.getElementById('ssenotif').innerHTML.indexOf('/software/order') != -1) { location.href = '/software/order?downloadinvoice=1'; } } setInterval(checkIncomingOrder, 10000); // time in milliseconds // Get window query string const urlParams = new URLSearchParams(window.location.search); const downloadInvoice = urlParams.get('downloadinvoice'); // Download the invoice if (downloadInvoice == 1) { // Get last order code const ordercode = document.getElementById('orderlist').firstChild.getAttribute('data-ordercode'); // Open invoice window console.log('Downloading invoice for order: ' + ordercode); const openedWindow = window.open('/software/invoice/' + ordercode); // Close invoice window setTimeout(function() { openedWindow.close() }, 10000); } console.log("Auto invoice send activated");