checkout/?dd-to-cart executed twice




Wordpress LScache Plugin: checkout/?dd-to-cart executed twice

Last Updated on: Wed, 15 Apr 2026 00:00:02
The above test page should add only one product id 160 but when LiteSpeed is activated the product is added twice because the page is opened twice. After testing around and reading the log files I saw that it maybe LiteSpeed and indeed, when I deactivate LiteSpeed than it works. As this should be a plugin we cannot deactivate LiteSpeed and it must work on any system, even when LiteSpeed is activated. How can we prevent LiteSpeed to open the page once. Once the page was opened then it works but this is not a solution as it must work for the very first time. The page I need help with: https://pa.marfruits.com/checkout/?add-to-cart=160&shoppingCartId=cc9537e9-5af0-4598-9079-3e729e9119d2 For testing, disable Guest Mode. Purge Cache and try again. Did you just directly access the URI like you posted ? instead of click add to cart kind of button ? Yes, this URL is called as you see it in the plugin because it adds a product ? triggered by a certain situation ? directly into the shopping cart. When I add for example &quantity=25 then the shopping cart has 50 products of the item. Then wp_redirect($addToShoppingCart) is called. Did you just directly access the URI like you posted ? com. com. com. @cbdfactum The issue you describe is a logical consequence of the guest mode. If a page is requested first time guest mode loads page again. If the first request goes directly to a URL that adds items directly to the cart, it is logical that number of items are doubled. Either you disable guest mode or @CacheCrawler finds a way to disable guest mode if a certain link/Url is requested. OK, I understand. I think you agree I cant do much about it as its a plugin and the plugin cannot really force the WordPress webmaster to set the settings so it works. I confirm that when I disable the Guest-Mode then the it works as expected. Any other suggestion? I didnt find a way how to set the quantity in the WooCommerce to 1 ? this would make it immune against any multiple calls. Be patient, maybe @CacheCrawler has any idea how to solve it. Maybe adding a parameter like liteSpeedGuestMode=off would solve this quickly and reliable as the parameter would be ignored by other modules or could be then removed from the request. This would be the idea behind a possible solution. In normal condition without a fullpage HTTP cache this could be done easily, but if a page is cached there is no more PHP interpreter that can be executed. Full page cache means the output is plain HTML like it is if you use browser function to store a requested page local on your computer. It is possible, of course, but to solve it easily cache and the function for guest mode must be disabled whenever a request has certain parameter or $_GET query like it is used for adding an item to cart. Again, maybe @CacheCrawler has any idea. please try add this to your wp-config.php , next line after



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference