Dear support,
On https://bodensee-liebe.com/, we have a problem. Sometimes – not always – and especially when ordering many products in many variations, the cache seems to make problems. If you click add to cart, sometimes it’s added, sometimes it’s not, sometimes it doesnt increase the number of products in the cart but then they are actually there, and sometimes vice-versa. It does not always happen, which definitely makes it difficult to debug. We already moved the server to a better one, no success, I installed and deinstalled multiple caching plugins (not all are compatible with the xStore theme but the current one officially is). Debugging the plugins did not help.
Here is a demo video from someone working there, showing the issue: https://drive.google.com/file/d/11v0x-9K2GX6IB5tTzLke-tDAJYBeNT0f/view?usp=sharing. It seems to be the same problem as someone here https://www.8theme.com/topic/problem-with-variable-product-add-to-cart-after-last-update/ had.
I check all logs. Here’s what I concluded:
PHP Error log
[17-Jul-2024 15:07:40 UTC] PHP Deprecated: Der Hook woocommerce_rest_api_option_permissions ist seit Version 6.3.0 veraltet und es ist keine Alternative verfügbar. in /www/htdocs/w01c1c47/Bodenseeliebe_neu/wp-includes/functions.php on line 6085
[17-Jul-2024 15:14:48 UTC] PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/htdocs/w01c1c47/Bodenseeliebe_neu/wp-includes/functions.php on line 7300
[17-Jul-2024 15:14:48 UTC] PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/htdocs/w01c1c47/Bodenseeliebe_neu/wp-includes/functions.php on line 2189
[17-Jul-2024 15:15:03 UTC] PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /www/htdocs/w01c1c47/Bodenseeliebe_neu/wp-content/plugins/pw-bulk-edit/includes/pwbe-functions.php on line 111
I am still seeing a lot of these, even though all is up to date and updated. Anything we could miss?
As for the access logs:
I am seeing some requests that take longer than the others, but I am not seeing any failures here. All requests are correct – 200, so it’s 99% not a server-side thing!
As for the bug:
I does seem to come up the most when products in different variations are added, especially when done so fast after each other, which does happen quite regularly for this shop (A big vendor buying 100 products and clicking through fast)
The problem seems to come from either of these two:
a) problems with .js that break the theme’s .js once in a while (there are some console errors related to the Swiper).
jquery.min.js?ver=3.7.1:2 Uncaught ReferenceError: Swiper is not defined
at HTMLDivElement.
at Function.each (jquery.min.js?ver=3.7.1:2:3129)
at e.
at etTheme.autoinit.swiperFunc.etTheme.swiperFunc (swiperInit.min.js?ver=1.0:1:440)
at Function.
at Function.each (jquery.min.js?ver=3.7.1:2:3179)
at etTheme.init (etheme-scripts.min.js?ver=1.0:1:15807)
at HTMLDocument.
at e (jquery.min.js?ver=3.7.1:2:27028)
at t (jquery.min.js?ver=3.7.1:2:27330)
Any leads on where do they come from? It’s the theme, so I can’t just jump in and edit stuff here. What’s behind the swiper library?
There are some other problems with the theme as well:
a) In case of a correct addition there are 4ajax calls being made:
etheme_svp_cart
etheme_update_cart_item_quantity
etheme_added_to_cart_popup
etheme_check_product_in_cart
b) In case of the infinite loop, I got stuck at a single one, only:
etheme_svp_cart
Unfortunately, there are no extra access log or php debug log instances when this has been happening. So, my personal conclusion is that it’s a problem with a theme, so many ajax actions with JavaScript, done one by one are odd to see, and potentialy they could be the culprit.
Summing it up it strongly seems like a theme issue, and as mentioned, similar to here: https://www.8theme.com/topic/problem-with-variable-product-add-to-cart-after-last-update/. Imho, it’s an odd solution, so 99% it’s .js fault.
The site has no staging, but also very little visitors, and live testing on it would be ok, as long as we don’t interrupt for days. Just activate maintenance if you are at it: https://bodensee-liebe.com/wp-admin/admin.php?page=maintenance.
Here for any questions. It’s a very nasty error since it is not regularly reproducible. Sometimes it comes up a lot, sometimes not so much, but even spending many hours debugging I couldnt find the “one” pattern where it would always come up. I’m a bit desperate and very much hope you can help. Clients of the buisness have not been ordering somtimes since they encountered these issues and were really annoyed by the cart not updating, then suddenly updating too much, then the add to cart not reacting…strange.
Thank you and very best,
Timo