• Hi,

    For some reason, the website will email me every now and again with an E_Error, it points to occurances of
    WC()->cart->get_cart()

    All plugin and theme references with this inside are included in the error, but I can’t for the life of me figure out why!

    Would replacing this for another line work? What I can’t understand is we are on the latest version of WordPress & WooCommerce, this has only started to happen recently.

    Kind Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,

    WC()->cart->get_cart() should certainly work with WooCommerce 3.x.

    Can you please let us know what the error message is? It would help a lot to understand where the error could be coming from.

    Thank you,
    Joey

    Thread Starter danielmoorehbd

    (@danielmoorehbd)

    Hi @jricketts4,

    This is the spooky bit, it does work! It just generates an error once a day, but not always at the same time each day…

    The full message is below, I’ve asked their plugin support page, but this wasn’t how the error started, it started crying about this particular line in the Storefront theme, I’ve commented it out and the error is now picking on a plugin:

    Error Details
    =============
    An error of type E_ERROR was caused in line 48 of the file /wp-content/plugins/side-cart-woocommerce/public/class-xoo-wsc-cart-data.php. Error message: Uncaught Error: Call to a member function get_cart() on null in /wp-content/plugins/side-cart-woocommerce/public/class-xoo-wsc-cart-data.php:48
    Stack trace:
    #0 /wp-includes/class-wp-hook.php(286): xoo_wsc_Cart_Data->get_cart_content('')
    #1 /wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
    #2 /wp-includes/plugin.php(465): WP_Hook->do_action(Array)
    #3 /wp-content/plugins/side-cart-woocommerce/public/partials/xoo-wsc-markup.php(68): do_action('xoo_wsc_cart_co...')
    #4 /wp-content/plugins/side-cart-woocommerce/public/class-xoo-wsc-cart-data.php(37): require_once('/var/www/vhosts...')
    #5 /wp-includes/class-wp-hook.php(286): xoo_wsc_Cart_Data->get_cart_markup('')
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘E_Error whenever WC()->cart->get_cart() is called’ is closed to new replies.