0

Drupal Commmerce is creating an empty order for every single anonymous user in my website (over 13000 in just a few hours).

Users on my website have no direct access to the shopping basket, nor do they have any means of adding products to the cart, since for the moment, I'm only planning to use the Drupal Commerce functionality for specific users (i.e. I will create a product in the backend, then send the URL to the customer).

It doesn't seem right that so many orders are created for users who don't even have the shopping basket block in their page.

Why does this happen?

Is there a way to prevent it?

You can see in the screenshot how the empty-basket orders are being created for every anonymous user, this is slowing down the site!

Anoymous user orders created - empty baskets

  • Are you sure that urls are not public? Not having the shopping basket block available does not means that they can not access the specific url of the product variation or product display and then click under add to cart – Gianni Di Falco Feb 17 '15 at 13:06
  • @GianniDiFalco Those URLs (as of now, only 1) are only accessible by direct access. However, when a person just loads the frontpage, an empty order is created ... – bmunslow Feb 17 '15 at 13:07
  • Yep that's pretty standard in my experience. The 'culprit' is commerce_cart_order_id(), which can be called from a multitude of places. If you have the cart block active, for example, it will be called during the build process for all users – Clive Feb 17 '15 at 13:24
  • @Clive so this is standard behaviour? Should I just let the orders table be vastly populated? I have seen a clear decrease in performance. – bmunslow Feb 17 '15 at 13:31
3

There's nothing in core Drupal Commerce that would create an empty order for every anonymous session. Core Commerce will only create an order when an anonymous user adds a product to the shopping cart. This means some other module must be creating those orders for every session. I'd look to your contributed modules, especially if any are facilitating adding products to the cart via links instead of forms.

  • 1
    You are absolutely right! I found out the culprit was module Commerce Marketplace, which I've disabled for the moment. – bmunslow Feb 19 '15 at 8:19
0

As long the users click on the cart link that is a normal behavior. Why ? The far I'm concern Drupal Commerce assign an unique order id for each user. This can help you to determine when the user leave your site before they did not make the purchase. In addition, if the user leave and comeback this is going to keep the all the order information where they left out last time.

-1

Here is the solution: Creating blank order for each new unique session. Some details about it:

  • it includes some code that you can use as a patch (though not available in patch format, yet).
  • it contains a comment that seems to confirm that it indeed solves the issue and (so far) with no drawbacks.
  • Welcome to Drupal Answers. When posting an answer you should actually write the answer or at least quote the most important part, if referencing an external source (which might disappear), instead of answering with a link. – googletorp Mar 25 '16 at 10:11

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.