Fatal Error – product-added-to-cart.php:26

This topic has 26 replies, 3 voices, and was last updated 2 years, 6 months ago ago by Olga Barlow

  • Avatar: bnourse
    bnourse
    Participant
    May 12, 2022 at 22:52

    We are experiencing a fatal error, often several times per day.

    The log entry is as follows:
    2022-05-12T04:25:09+00:00 CRITICAL Uncaught Error: Call to a member function is_visible() on null in /nas/content/live/borregooutfitt/wp-content/themes/xstore/woocommerce/product-added-to-cart.php:26
    Stack trace:
    #0 /nas/content/live/borregooutfitt/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include()
    #1 /nas/content/live/borregooutfitt/wp-content/themes/xstore/framework/woo.php(1866): wc_get_template(‘product-added-t…’, Array)
    #2 /nas/content/live/borregooutfitt/wp-includes/class-wp-hook.php(307): etheme_added_to_cart_popup(”)
    #3 /nas/content/live/borregooutfitt/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(”, Array)
    #4 /nas/content/live/borregooutfitt/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
    #5 /nas/content/live/borregooutfitt/wp-admin/admin-ajax.php(202): do_action(‘wp_ajax_nopriv_…’)
    #6 {main}
    thrown in /nas/content/live/borregooutfitt/wp-content/themes/xstore/woocommerce/product-added-to-cart.php on line 26
    Please advise. Thanks for the assistance, the theme is great for our site.

    Please, contact administrator
    for this information.
    25 Answers
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 13, 2022 at 15:36

    Hello,

    1) Describe your actions step by step to reproduce the error, please.
    2) Try to disable all the third-party plugins (including cache plugins), that do not come bundled with XStore https://www.8theme.com/documentation/xstore/plugins/included-plugins/ , clear the cache of the browser, and check then. Maybe one of the additional plugins is a reason for the problem.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    May 13, 2022 at 16:19

    Hello Olga,
    We cannot replicate the error directly, and it occurs only a few times per day.
    We cannot disable all plugins, because our production site – where the errors occur, depends on them for its operation. We do not have any caching plugins – the only caching on the site comes from WPEngines, and the associated Cloudflare CDN.
    It seems that this error is coming from XStore – can you track it down in another way??
    Best regards,
    Ben

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 13, 2022 at 16:52

    Hello,

    If it’s not allowed to disable plugins on the production site then could you, please, create a staging site (full copy of the production)? Because we will need to make tests and code changes to fix the issue, so then better if do this on the staging site than on production.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    May 13, 2022 at 18:44

    Hello Olga,
    I have pushed a fresh copy of the site to our staging site. Admin credentials and sftp info is in the private content area.
    I will not change anything on that staging site until I hear back from you.
    FYI, there is no WPEngine or CDN caching on the staging site.
    Your assistance is much appreciated!
    Regards,
    Ben

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    May 14, 2022 at 13:37

    Hello,

    Thanks for the reply.
    One of our technicians will give an answer after the weekend. Please be patient

    Regards

    Avatar: bnourse
    bnourse
    Participant
    May 14, 2022 at 14:57

    Thanks for the update! I’ll stay tuned.
    Ben

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 16, 2022 at 11:17

    Hello,

    We are trying to reproduce the error on the staging site but never get that. Any chance that we could get a video from you where you face the error? Or at least what product do you add to the cart that gives the error?

    Function that we use and that gives the error in your log is the default WooCommerce function https://woocommerce.wp-a2z.org/oik_api/wc_productis_visible/
    We found a similar report about such an issue here https://wordpress.org/support/topic/ajax-call-error500/ and as we can see it was caused by the cache.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    May 17, 2022 at 00:01

    Unfortunately, I do not know what is causing this error and am not able to replicate it. It has been showing up a couple times a day, on most days, under the store traffic we have on the site.
    I notice that you must have cleared out our logs on the production site, and the error has not yet recurred. Did you make any other changes??
    At any rate, I’ll watch for the error, and perhaps get some help from wpengine, our hosting company, to explore whether there might be a cacheing exclusion needed related to this problem.
    Thanks again for your help trying to track this down.
    Regards,
    Ben

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 17, 2022 at 10:35

    Hello,

    I cleared the cache and then cleared logs to check if the error appears again. But did not get that.
    Ok, let me know if you face it again.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    May 17, 2022 at 13:05

    Thank you. I will keep an eye out and see if I can get to the bottom of this. I am deactivating admin access for now.
    Regards,
    Ben

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    May 17, 2022 at 14:25

    Hello,

    Ok, sure.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    June 3, 2022 at 21:38

    Hello,

    We are still being plagued by this fatal error. Can’t duplicate it, happens several times on most days.

    We have investigated more, the error is definitely related to the popup form of the Product Added Notification Type. If we use one of the other types of notification, this error does not occur. We really like this Popup form of Product added notification, and would really like to have it fixed. I understand it is difficult because it is hard to duplicate.

    The alternate form of notification, “Open cart Off-canvas/dropdown content” might work for us, but it has an issue, too. It works fine in mobile, with a slide-out that must be dismissed. But on desktop, the mini cart appears briefly, but disappears after a few seconds. Can it be made to persist on desktop, or better yet, just use the mobile form on desktop too?

    Finally, the 3rd form of notification, “Alert” would be a worst case implementation for us. Can you suggest the CSS needed so that we can set the color of the notification to match our site, which uses Orange color #e36e1e for such things?

    We appreciate your help in tracking this down. We suspect we’re not the only one having this problem. It would sure be great to solve it??

    Thanks in advance for your continued help.

    Ben

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 6, 2022 at 09:44

    Hello,

    1) Maybe the mentioned error appears with some specific product only. Could you, please, provide us with a link to the product that you add to the cart and get the mentioned error?

    2) Mini cart should not disappear till the moment you close that, check our demo https://xstore.8theme.com/elementor/demos/book-store/product/there-are-moms-way/
    If on your site it works in a different way, please, provide us with a link to the product with the issue to inspect that and WP Dashboard access with the admin permissions to check the settings that you use.

    3) Add the below code to Theme Options > Custom CSS to change the color of the alert

    .et-notify[data-type=success] {
        background: #e36e1e;
    }

    Regards

    Avatar: bnourse
    bnourse
    Participant
    June 6, 2022 at 23:29

    Hello Olga,

    Thanks for getting back to me.

    1) As I have explained, I am not able to duplicate this error. If it is product related, I can’t tell which one. It seems to occur randomly several times per day on our production site. You suggested earlier that it might be a cacheing issue. Can you suggest a cacheing exclusion I might want to have WP Engine add to the site?

    2) We are definitely NOT experiencing behavior as shown in your demo regarding the slideout add to cart option. I have configured our staging site that way and am providing credentials in the private area so you can have a look.

    3)The styling CSS works for Alert version of add to cart notification. But this is not the desired choice, for sure. We really like the popup version, just not the fatal errors that come with it.

    Thanks again for all your support, we can count on 8theme to help us with problems we might experience.

    Regards,
    Ben

    Please contact administrator
    for this information.
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 7, 2022 at 16:41

    Hello,

    1) But did you see that? Or who see that? What product did you add to the cart once get the error?
    I don’t see the mentioned error in the staging site error logs. What cache system do you use on your production site?

    2) Just set off-canvas type for the mini-cart https://prnt.sc/mx5CcOdf2Sxi

    3) We do understand this but we need to find out what causes the issue. We can’t fix the problem if it appears randomly and if we even do not get the error to check that.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    June 8, 2022 at 13:38

    Hello,
    Thanks for your response.
    1) See earlier in this thread. We do not use any 3rd party cacheing plugins on the site. The only cacheing is provided by WP Engine, our hosting vendor. If you might suggest a needed cacheing exclusion around this error, I can have them put it in place for us. I am sorry I cannot provide instructions for duplicating this error, but I do know it is happening regularly when the popup notification is turned on. From yesterday’s fatal error logs on the production site:

    2022-06-07T19:15:30+00:00 CRITICAL Uncaught Error: Call to a member function is_visible() on null in /nas/content/live/borregooutfitt/wp-content/themes/xstore/woocommerce/product-added-to-cart.php:26
    Stack trace:
    #0 /nas/content/live/borregooutfitt/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include()
    #1 /nas/content/live/borregooutfitt/wp-content/themes/xstore/framework/woo.php(1888): wc_get_template(‘product-added-t…’, Array)
    #2 /nas/content/live/borregooutfitt/wp-includes/class-wp-hook.php(307): etheme_added_to_cart_popup(”)
    #3 /nas/content/live/borregooutfitt/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(”, Array)
    #4 /nas/content/live/borregooutfitt/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
    #5 /nas/content/live/borregooutfitt/wp-admin/admin-ajax.php(202): do_action(‘wp_ajax_nopriv_…’)
    #6 {main}
    thrown in /nas/content/live/borregooutfitt/wp-content/themes/xstore/woocommerce/product-added-to-cart.php on line 26

    2022-06-07T19:19:25+00:00 CRITICAL Uncaught Error: Call to a member function is_visible() on null in /nas/content/live/borregooutfitt/wp-content/themes/xstore/woocommerce/product-added-to-cart.php:26
    Stack trace:
    #0 /nas/content/live/borregooutfitt/wp-content/plugins/woocommerce/includes/wc-core-functions.php(345): include()
    #1 /nas/content/live/borregooutfitt/wp-content/themes/xstore/framework/woo.php(1888): wc_get_template(‘product-added-t…’, Array)
    #2 /nas/content/live/borregooutfitt/wp-includes/class-wp-hook.php(307): etheme_added_to_cart_popup(”)
    #3 /nas/content/live/borregooutfitt/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(”, Array)
    #4 /nas/content/live/borregooutfitt/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
    #5 /nas/content/live/borregooutfitt/wp-admin/admin-ajax.php(202): do_action(‘wp_ajax_nopriv_…’)
    #6 {main}
    thrown in /nas/content/live/borregooutfitt/wp-content/themes/xstore/woocommerce/product-added-to-cart.php on line 26

    2) Thanks for the instruction about the mini-cart setting for add to cart notification. We may have to change to this if we can’t get the popup issue resolved.

    Regards,
    Ben

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 8, 2022 at 15:04

    Hello,

    Do you have these errors only on the live site or do you also have the same on the staging site?

    Do you see these errors in the error log only or it does appear while you add to cart product? What product did you add? Because you did not answer that question.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    June 8, 2022 at 15:43

    Hello,
    These occur only on the Live Site only, not on staging. Of course, staging does not have the same traffic as production.

    As I have said over and over, I cannot tell you what products are causing it or if it is just random. That is my answer to your question. Previously, you had access to the production site and were not able to duplicate. I did have it happen to me on the production site (the popup froze) and the error appeared, but when I reloaded and tried again with the same product, it was added just fine.

    As you can see from our fatal error logs, this is occuring each day.

    I think it may be related to cacheing. So, I will ask again: can you tell me a cache exclusion we should add that might effect the process or code that is running when the add to cart popup appears??? Or when this fatal error is generated?

    Thank you.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 8, 2022 at 16:19

    Hello,

    Please, try to disable and enable the WooCommerce plugin. After that check, if PHP session_path is writable.

    We use etheme_added_to_cart_popup function to add to cart. So, if you have the option to add that to exclusions then try that.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    June 8, 2022 at 18:47

    OK, trying to work with these suggestions.

    Can you tell me the file path to “PHP session_path” so I can check?

    WP engine has added these caching exclusions:
    arg: etheme_added_to_cart_popup
    path: ^/cart/?

    Do those look like they might worK?

    Sorry, my technical skills are limited.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 9, 2022 at 10:00

    Hello,

    PHP session_path depends on your server settings. Contact your hosting support about this.

    Regards

    Avatar: bnourse
    bnourse
    Participant
    June 9, 2022 at 12:42

    Hello,
    Well I did that, and my question came from them. Maybe there was a communication problem on my part.
    Anyway, since you have access for my other request re: autoload templates, perhaps you could look and tell me the path??
    And the cacheing exclusions??
    Thanks you.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 9, 2022 at 18:00
    Avatar: bnourse
    bnourse
    Participant
    June 10, 2022 at 00:25

    Hello,
    Thank you, I’ll take a look and see if anything here helps.
    Regards.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    June 10, 2022 at 07:49

    Hello,

    You are welcome. And don’t forget to disable and enable the WooCommerce plugin. That’s strange but I found a topic on the WordPress forum with a lot of users who reported that disabling and reenabling the WooCommerce helped with the mentioned fatal error.

    Regards

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

You must be logged in to reply to this topic.Log in/Sign up

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