I am facing an issue with intermittent duplicate orders.

The payment gateway is SecurePay (Australia) however by looking at the logs, the problem seems to be the codebase since I can see the following (addresses obscured):

./ssl_access_log.www10.1: - - [05/Nov/2013:01:18:32 +1100] "POST /checkout/onepage/saveOrder/ HTTP/1.1" 200 30 "https://foobar/checkout/onepage/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36" 2444 2204
./ssl_access_log.www10.1: - - [05/Nov/2013:01:18:42 +1100] "POST /checkout/onepage/saveOrder/ HTTP/1.1" 200 30 "https://foobar/checkout/onepage/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36" 2444 2204

So something is triggering saveOrder twice usually within a 10 second period so this is not a front-end issue where the user is clicking the button twice.

There is no one step checkout installed - it's a standard Magento one page checkout.

Edit: This is NOT a front-end issue where the user can click the button twice


This happens when the submit order button has no type specified but has a js action on it:

<button onclick="submitOrder()">Sumbit order</button>

Then the form is submitted and the js action is performed.
try to add type="button" on it.

  • how would this explain why it's intermittent across different browsers? – Francis Kim Nov 5 '13 at 11:23
  • I will take a look into this though, thanks. – Francis Kim Nov 5 '13 at 11:23
  • @FrancisKim. Not all browsers interpret this the same way. On IE i think the default type is "button" and on FF is "submit" – Marius Nov 5 '13 at 11:28
  • button is set to type="submit" which I think is correct. There are no other JS bound to that button except for the magento default onclick="review.save();" – Francis Kim Nov 5 '13 at 11:40
  • @FrancisKim. That's exacly what I was saying. review.save will submit the form, and type="submit" will submit the form again...Change the type to "button" – Marius Nov 5 '13 at 12:00

What often happens is that the user actually clicks twice.

To avoid that, you could disable the submit order button right after it has been clicked using Javascript.

I have seen that in place in many shops.

  • There is proper frontend validation to stop this actually. Thanks for your answer though. – Francis Kim Nov 5 '13 at 11:22

This may happen if you have some html validation plugins installed. One badly programmed plugin (can't remember it's name) fires the same http request again to load the content for the validation.


Although everything was done on the Magento side to ensure this problem is fixed, nothing helped. But grepping through server logs indicated that the issue was with an incorrectly setup CloudFlare - all smooth sailing now.

  • I am suffering from a problem that seems very similar (also using CloudFlare). What was the incorrect configuration? – erikkallen Dec 21 '17 at 21:09
  • @erikkallen I don't remember clearly but I believe it was using filters to disable most of the CloudFlare functionalities based on the URL (if it contains 'checkout' 'cart' or similar, disable cache, disable everything). Hope this makes sense. – Francis Kim Dec 21 '17 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.