Missing Orders Mysteries

Posted by Joe on April 1, 2021

It's an all-too-common occurrence - perhaps you came across the option to filter by 'Missing Orders' in the admin panel, or perhaps a customer emailed or called to ask about the status of an order that seems to be quite literally missing in the orders list.

Whatever the circumstances, when you filter by 'Missing Orders' a horrible sight meets your eyes - loads of orders that you never knew about, which were nowhere to be seen until now! Where have all these orders come from - more importantly, why have they gone missing? And what can be done about it?

Don't panic!

First of all, don't panic! There may not be an issue at all. The name 'Missing Orders' is a bit of a misnomer, and they are more accurately referred to as unconfirmed orders.

Any order in your store's database which doesn't yet have a status (Pending, Processing, Complete, etc.) has the status of 'Missing' by default. But why would an order be made without assigning it a status?

All orders start off as Missing Orders

An order is first added to the store's database when the customer reaches Step 6 "Confirm Order" of the OpenCart checkout. This order will have a default status of 'Missing'; the responsibility of giving an order its first status actually lies with the payment extension.

The idea is that the customer enters their payment details, the payment extension confirms payment has been made (if necessary), and gives the order its first status, thereby confirming the order and pulling it out of Missing Orders. OpenCart will then send notification emails to the customer and store admin, and so forth.

So a Missing Order is only an order for which payment hasn't been 100% confirmed. This means that any case where a customer reaches the final step of the checkout then doesn't proceed with payment will result in a Missing Order added to your store's database.

If the customer changes their mind at the end of the checkout and goes to another page, or exits their browser, the order will already have been added, but with Missing status. Even if the customer goes back a step to select a different payment method, OpenCart will consider this another new order when they proceed again to the final step of the checkout, which is why sometimes multiple copies of the same order can be found in Missing Orders.

Most cases of Missing Orders are therefore harmless, and result from a quirk in the way OpenCart handles orders. However, if your accounts show payments for orders listed as Missing Orders in your store's admin panel, this would indicate an issue with the order confirmation process.

Callbacks

Callbacks - variously known as IPNs by Paypal, Webhooks by Stripe, Transaction Feedback by Barclaycard, and other names - are the way that your store confirms with an external payment provider that a payment has been accepted.

They generally work like this:

  1. Customer enters their payment details, either on your store's checkout page or on an off-site payment page. These are sent to the payment gateway.
  2. The payment gateway verifies the payment, and if valid, their servers make a 'call back' to your store's server to confirm the order paid.
  3. The relevant payment extension receives the message and confirms the order in your store by assigning it a status, pulling it out of Missing Orders.

As with anything that relies on an outside server, there are a lot of opportunities for things to go wrong here.

  • Are the callback settings properly configured in your payment provider account dashboard? Several payment providers expect a "Callback URL", so they know where exactly on your site the callback should go. This would normally be found in the payment extension settings in the OpenCart admin panel, and can be copied-and-pasted to the relevant text box in your payment account dashboard. We've previously written an article that shows how to set this up for PayPal Standard.

  • Are the callback requests reaching your website's server? You may need to consult your payment provider and/or hosting provider as to whether they can see any failed connection attempts, or if incoming callbacks from the payment gateway are possibly being blocked by a firewall on your server.

  • If the callbacks are being received by your store, are they being correctly processed by the payment extension? Payment providers often make changes to their APIs and protocols to keep up with ever-changing security regulations, and if your payment extension hasn't been updated in a while it could mean some compatibility-breaking changes have been introduced in the meantime. Upgrading to the latest version of the payment extension may solve the issue; if it's a third-party extension, the extension developer should be able to advise on any changes introduced by the payment provider that may cause Missing Order issues.

  • If your website's server is running a PHP version older than 5.6, it might be causing issues with some extensions that use curl_exec to initiate the callback request, such as PayPal Payments Standard. If this is the case with your server, it's time to upgrade! Either contact your hosting provider, or check out our hosting plans if you would prefer your site to be hosted by OpenCart experts.

Other Extensions

A lot of extensions add various extra bits to OpenCart's order confirmation routine - the code that gives an order its first status and pulls it out of Missing Orders. It's possible that some of this additional or changed code is causing the order confirmation routine to crash or otherwise misbehave. This gets more likely the more extensions you have modifying the same areas of code, as the chances of a clash or conflict increase.

We once saw an instance of a badly-written anti-fraud extension causing major Missing Order chaos. The extension was supposed to verify the IP address of every incoming order, but crashed on startup, resulting in a Fatal Error when trying to confirm any order! This is just one example of the ways that third-party extensions can affect the order confirmation process.

Check your OpenCart error log and server error log for errors relating to files such as catalog/model/checkout/order.php or catalog_model_checkout_order.php. A sure-fire indicator is if you can find references in errors to addOrderHistory - the name of the order confirmation routine.

In the case of third party extensions, generally the extension developer themselves would be best able to assist - however it can often be quite difficult to tell which changes to code are being made by which extensions, so you may wish to consult an OpenCart expert to help resolve conflicts between multiple third-party extensions.

Session Cookies

A rather obscure one that reared its head in mid 2020 - while the customer is on the payment page, order details are kept in the customer's session cookie - the same thing that 'remembers' when you're logged into a website.

Some recent changes to how web browsers handle these cookies means that when returning from the payment page, the customer's session cookie can be reset, causing OpenCart to 'forget' what order needs to be taken out of Missing Orders!

This issue usually manifests itself in paid-for orders only sometimes being found in Missing Orders, since it is dependent on the customer's web browser. Another sign is in the OpenCart error log - look for errors mentioning Undefined index: order_id that come from payment-related files. If the corresponding line in the file includes this: $this->session->data['order_id'] - it's a very likely sign of session cookie issues.

This issue more often than not affects older versions of OpenCart 1 and 2 - luckily we've developed a free extension to bring these versions up to date with the new regulations on session cookies. The extension has versions for OpenCart 1.5.6.4 and all versions of OpenCart 2. If your Missing Order symptoms sound like the above, this extension may well do the trick.

Get in touch

If none of the above did the trick, why not have the issue looked at by an OpenCart specialist? Contact us today for a quote and we'll take a look!