Below is a Java Script that you can run on the order page a few seconds prior to sale by pasting and executing it via JavaScript console.
This is totally untested, so use completely at your own risk.
Note that I have not made my purchase using this script.
PHP:
setInterval(function() {
var buttonItems = document.getElementsByTagName('button');
for (var i = 0; i < buttonItems.length; i++) {
var buttonItem = buttonItems[i];
if (buttonItem.textContent.includes("Add") && buttonItem.textContent.includes("Cart")) {
buttonItem.click();
}
}
}, 10);
What it does...
1. Start a 10 millisecond timer in the page.
2. On each timer hit, get the list of buttons in the HTML page.
3. Iterate through the list of buttons and if any of them have Add and Cart in the button text, then invoke that button.
The idea is that this script will try to invoke all the Add Cart buttons with a 10 ms gap. Once the items get added to cart, you can navigate to cart, remove the stuff you don't need and complete the purchase.
Things to note,
1. JavaScript timers do not have a lot of precision and can also drift over time.
2. The entire script is based on assumption that the "Add cart" will be a button type element and the text content contains the words "Add" and "Cart". Presently, The Add to Cart buttons on Amazon satisfy these assumptions.
3. Navigating away from the page will kill the timers as well. So if you click on something that causes a navigation and to come back afterwards, the script is no longer running.
4. Once items get added to cart, navigate to cart or some place else and the timer will get killed.
5. If you know before hand the order of the items and consequently the the order of the buttons, you can tweak the code to selectively try to add your item of interest only.
Again, this is totally untested, so use at your own risk.