Problem with variable product add to cart

This topic has 9 replies, 3 voices, and was last updated 4 months, 1 weeks ago ago by Andrew Mitchell

  • Avatar: TSpinde
    TSpinde
    Participant
    July 18, 2024 at 07:24

    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. (swiperInit.min.js?ver=1.0:1:2097)
    at Function.each (jquery.min.js?ver=3.7.1:2:3129)
    at e..each (jquery.min.js?ver=3.7.1:2:1594)
    at etTheme.autoinit.swiperFunc.etTheme.swiperFunc (swiperInit.min.js?ver=1.0:1:440)
    at Function. (etheme-scripts.min.js?ver=1.0:1:15843)
    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.
    (etheme-scripts.min.js?ver=1.0:1:15915)
    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

    Please, contact administrator
    for this information.
    8 Answers
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 18, 2024 at 11:53

    Dear @TSpinde,

    Thank you for providing the necessary details.

    We advise you to initially downgrade your PHP version to at least 8.1 or 8.2 and then verify the functionality. Additionally, we recommend testing with the default Storefront theme, as the functionality for adding/removing products is primarily handled by the WooCommerce plugin, rather than the theme itself.

    Please be aware that many plugins may not be compatible with the most recent PHP versions, which could potentially lead to suboptimal performance.

    Regarding your issue with the swiper js being undefined, this will be resolved once you activate patch #93158818 in the XStore patcher. For guidance on using the XStore patcher, please visit: https://www.8theme.com/documentation/docs/how-to-use-xstore-patcher/.

    Best regards,
    Jack Richardson
    The 8Theme Team

    Avatar: TSpinde
    TSpinde
    Participant
    July 18, 2024 at 12:28

    Hi Jack,

    thank you very much! Yes, the problem is resolved if I activate the default wordpress theme, not xstore, but I want to use xStore. The problem is not resolved when deactivating all other plugins. So the issue mus have something to do with xStore – Woocommerce and maybe the cache.

    I applied the fixes you mentioned, downgraded PHP to 8.2 and applied the patches. However, the problem still persist:

    https://www.awesomescreenshot.com/video/29670318?key=8f98a45ee167c8fe8bdde27b833fef01

    In the video you can see the easiest way on how the problem can be triggered, especially when adding products in higher quantity. Sometimes it works, sometimes it does not.

    Do you have any other ideas?

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 18, 2024 at 14:39

    Dear @TSpinde,

    We kindly request that you conduct your tests using the official Storefront theme, which is developed by WooCommerce and recommended for assessing their core functionalities. Additionally, it appears necessary to deactivate the Ajax functionality, as indicated here: https://www.awesomescreenshot.com/image/49487498?key=b768755426f7c62ce6b57f5d250e8b43. This step is crucial because the Ajax product results may encounter issues when there are excessive items in the mini cart.

    Thank you for your attention to these matters.

    Best regards,
    Jack Richardson
    8Theme’s Team

    Avatar: TSpinde
    TSpinde
    Participant
    July 18, 2024 at 15:09

    Dear 8theme authors, if I activate storefront, it does work, but how does that help? The issue seems to be stemming from xStore. If I deactivate the ajax it does work, but the ajax functionality is very helpful.

    Is there no way to know why this does not work?

    Very best and thank you for your help.

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 18, 2024 at 15:34

    Dear @TSpinde,

    We hope this message finds you well. We understand your inquiry regarding the relationship between AJAX and the issue you are experiencing. Please find below a detailed explanation:

    1. The process of adding a product with AJAX initiates several WooCommerce actions, which include numerous actions and filters specifically affecting the mini-cart content.

    2. Each product reloaded in the mini-cart possesses its own product object. This object must be loaded initially, after which only the necessary data for display in the mini-cart content is extracted from the product object.

    3. Once all content is generated server-side, AJAX returns this content. In your scenario, the returned data is substantial, which may occasionally prevent the mini-cart quantity from refreshing accurately. This could be due to the size of the data returned or another underlying issue.

    To address this, we have provided a solution involving the deactivation of AJAX to ensure correct functionality and refresh of the mini-cart. However, please note that with AJAX enabled, there are observed issues when refreshing the mini-cart with more than 35 items.

    We hope this explanation clarifies your concerns.

    If you require personal customization services, we invite you to submit a request through our customization panel at: https://www.8theme.com/account/#etheme_customization_panel , and continue conversations with the technicians team directly.
    Please be advised that customization services will incur additional charges, the exact amount of which will be communicated following a detailed review of your request.

    Should you have any further questions or require additional assistance, please do not hesitate to contact us.

    Best Regards,
    Jack Richardson
    The 8Theme Team

    Avatar: TSpinde
    TSpinde
    Participant
    July 18, 2024 at 15:37

    Dear Jack,

    so basically you are saying that the cart ajax designed in xStore, a theme with 45,544 sales, is not fit to deal with adding multiple items to the cart at once, is that correct? It is a little bit disappointing, is there any chance this will be updated in future versions?

    Thank you for the support.
    Very best,
    Timo

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 19, 2024 at 07:07

    Dear @TSpinde

    Thank you for your message and for raising your concerns.

    There are some fundamental considerations taken into account during the development process to ensure the reliability of the theme. This process typically does not cater to the 1% of customers who might extensively test the site by adding products indefinitely and repeatedly. If we were to now combine and develop a solution for this 1% of your clients who might potentially engage in such behavior, it could jeopardize the compatibility and functionality for the vast majority of our existing customers who have already configured their websites and rely on the current setup.

    Therefore, it is not feasible from our side to take the step you suggested, as it might compromise the experience for the majority. However, if you are interested in finding a solution specifically for your unique client scenario, where the user wishes to add products in this manner, we are open to considering this as a customization.

    Please feel free to reach out to us, and we will review the possibility of creating a tailored solution for your needs.

    Thank you for your understanding.

    Best regards,
    Jack Richardson
    The 8theme’s team

    Avatar: Andrew Mitchell
    Andrew Mitchell
    Support staff
    July 19, 2024 at 07:08

    Dear TSpinde,

    Choosing our theme reflects your commitment to quality, and for that, we’re genuinely grateful. As we constantly strive to elevate your experience, your feedback is an invaluable gift. Could you kindly take a moment to rate our product with 5 stars on ThemeForest?

    Click here to share your insights: https://themeforest.net/downloads

    Your support fuels our journey, and we appreciate it more than words can express.

    Best Regards,
    The 8Theme Team

  • Viewing 9 results - 1 through 9 (of 9 total)

The issue related to '‘Problem with variable product add to cart’' has been successfully resolved, and the topic is now closed for further responses

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.