[Skip to main content](#vessel-content)

#   Cart table growing in size - 400,000 records!

##

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

1 year 9 months ago [\#365301](#365301) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#365301 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")* was created by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")*

-- HikaShop version -- : 5.1.2
-- Joomla version -- : 5.2
-- PHP version -- : 8.2

Looking at a couple of sites realised the cart table is growing to a ridiculous size.
The cart retaining period is setup.
[ ![cartretaining.png](/forum/attachment/60158) ](/forum/attachment/60158 "cartretaining.png")

- [ ![cartretaining.png](/forum/attachment/60158) ](/forum/attachment/60158 "cartretaining.png") [ ](/forum/attachment/60158?download=1 "cartretaining.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86324
- Thank you received: 14288
-
-

1 year 9 months ago [\#365302](#365302) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#365302 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Hi,

You want to reduce the frequency as much as possible. That way, the old records will be deleted more often.
With a 1 day delay, only 50 carts will be deleted each day. If, for example, you have 2000 carts being created on the website every day, with 50 old carts being deleted every day, that's 1950 carts piling up every day. And that will quickly grow to 400K records.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

1 year 9 months ago [\#365305](#365305) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#365305 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Thanks, just been looking at *hikashop\_cleanCart()*.

I see the default for *cart\_batch\_removal\_quantity* is defaults to 50 and I cannot see anyway in Hikashop code for changing that without adding some coding. That's no problem but I wonder if core Hikashop could be improved.

i.e. Ability to remove the quantity limit (i.e. set it to 0) and purge all carts older than, say, 7 days.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86324
- Thank you received: 14288
-
-

1 year 9 months ago [\#365308](#365308) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#365308 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Hi,

That's a hidden option.
If you want to change the value, you can do so by adding an entry to the hikashop_config table of your database with the namekey cart_batch_removal_quantity and the value you want via your PHPMyAdmin.
So no code is needed.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

1 year 9 months ago [\#365358](#365358) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#365358 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Looking at admin/customers/cart page:
..../administrator/index.php?option=com_hikashop&amp;ctrl=cart&amp;cart_type=cart&amp;limitstart=40&amp;limit=20

Then cross referencing the IP addresses with the server access log I see that all these carts are being created by robots.

216.244.66.231 - - [25/Jan/2025:06:40:32 +0000] "GET ... (compatible; DotBot/1.2; +https://opensiteexplorer.org/dotbot; help@moz.com)"
54.36.149.61 - - [25/Jan/2025:06:40:36 +0000] "GET ... (compatible; AhrefsBot/7.0; +http://ahrefs.com/robot/)"
85.208.96.197 - - [25/Jan/2025:06:40:44 +0000] "GET ... (compatible; SemrushBot/7~bl; +http://www.semrush.com/bot.html)"
74.125.212.193 - - [25/Jan/2025:06:40:45 +0000] "GET ... (X11; Linux x86_64; Storebot-Google/1.0)

Should robots be allowed to add things to the cart, is it necessary for search engine crawlers?

In helper.php there is a function *hikashop\_checkRobots()* which does not appear to be being used anywhere.

There is this Joomla function which does a search through a massive list (incomplete) of known robots.
Joomla\CMS\Environment\Browser\isRobot()

Are there better ways of handling this?

I suppose a plugin which handles the *onBeforeCartSave* event and calls *isRobot()* might be one way of preventing the #__hikashop_cart table from filling up with robot visits.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86324
- Thank you received: 14288
-
-

1 year 9 months ago [\#365360](#365360) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#365360 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Hi,

No, it is not necessary to allow bots the creation of carts.
The first thing to do would be to use the robots.txt file of your website to forbid access to the add to cart URLs for bots.

Indeed, having a small plugin checking the isRobot status with the onBeforeCartSave event would be a more agressive solution.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[mohairbears](/forum/user/916-mohairbears "View mohairbears's Profile")**
- [![mohairbears's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/916-mohairbears "View mohairbears's Profile")
- [ Offline](/forum/user/916-mohairbears)

Less More

- Posts: 610
- Thank you received: 13
-

1 year 7 months ago [\#366198](#366198) by [mohairbears](/forum/user/916-mohairbears "View mohairbears's Profile")  Replied by *[mohairbears](/forum/user/916-mohairbears "View mohairbears's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#366198 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Hi, is this the code to add to robots.txt file?

Disallow: /index.php/customerzone

Rgds

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86324
- Thank you received: 14288
-
-

1 year 7 months ago [\#366201](#366201) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#366201 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Hi,

What to add depends on your situation.
What are the URLs used for the add to cart buttons on your website ?
Based on this, you can add disallow rules.

You can also disallow the whole website for some user-agents. For example, if you want to disallow the bots from SemrushBot, you can add: Code:

User-agent: SemrushBot Disallow: /

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[mohairbears](/forum/user/916-mohairbears "View mohairbears's Profile")**
- [![mohairbears's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/916-mohairbears "View mohairbears's Profile")
- [ Offline](/forum/user/916-mohairbears)

Less More

- Posts: 610
- Thank you received: 13
-

1 year 7 months ago [\#366209](#366209) by [mohairbears](/forum/user/916-mohairbears "View mohairbears's Profile")  Replied by *[mohairbears](/forum/user/916-mohairbears "View mohairbears's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#366209 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Same situatuon as OP, 1,000's of carts with individual items being created daily.
I disallow mulitple carts but that does not work. only way I can control is is, to set to empty after 2 days but this annoys my regual customers

Don't understand this question? What are the URLs used for the add to cart buttons on your website ? add to cart is the usual method from the popup on the product pages

No idea who's bots are doing this, how do I find that out?

Rgds

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[brainforge](/forum/user/423-brainforge "View brainforge's Profile")**
- [![brainforge's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar423.jpg)](/forum/user/423-brainforge "View brainforge's Profile") Topic Author
- [ Offline](/forum/user/423-brainforge)

Less More

- Posts: 298
- Thank you received: 5
-
-
-
- [](https://brainforge.co.uk)
-

1 year 7 months ago [\#366213](#366213) by [brainforge](/forum/user/423-brainforge "View brainforge's Profile")  Replied by *[brainforge](/forum/user/423-brainforge "View brainforge's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#366213 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

[ developers.google.com/search/docs/crawli...%20out%20of%20Google](https://developers.google.com/search/docs/crawling-indexing/robots/intro#:~:text=A%20robots.txt%20file%20tells,web%20page%20out%20of%20Google).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86324
- Thank you received: 14288
-
-

1 year 7 months ago [\#366216](#366216) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart table growing in size - 400,000 records!](/forum/27-checkout/909044-cart-table-growing-in-size-400-000-records#366216 "-- HikaShop version -- : 5.1.2 -- Joomla version -- : 5.2 -- PHP version -- : 8.2  Looking at a couple of sites realised the cart table is growing to a ridiculous size. The cart retaining period is setup.")*

Hi,

First, I had not seen that you were not the same person, sorry.
Also, your question in your initial message was about the robots.txt
But I don't think changing the robots.txt will help you, if your problem is that you have too many carts in the database.
As I said in my first message on this thread, the first thing to do is to reduce the "Frequency of checks for the cart" setting to be as low as possible.
Reducing the retaining period is not a good strategy. As you said, it will annoy your customers. Also, it doesn't help reducing the amount of carts. It's the check frequency you want to reduce.
Also, you can simultaneously increase the cart_batch_removal_quantity as I was explaining in [ www.hikashop.com/forum/checkout/909044-c...-records.html#365308](https://www.hikashop.com/forum/checkout/909044-cart-table-growing-in-size-400-000-records.html#365308)

Just doing these 2 things should be way enough in most cases.

Regarding the robots.txt I can't say exactly what needs to be done without analyzing the website. Please provide the URL of the shop and I can tell you what you could add to help.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0LzkwOTA0NC1jYXJ0LXRhYmxlLWdyb3dpbmctaW4tc2l6ZS00MDAtMDAwLXJlY29yZHM/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.090 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
