• Pexle Chris

    (@pexlechris)


    Hi

    2021-11-15T00:47:21+00:00 CRITICAL Uncaught Error: Call to a member function get_cart_contents_count() on null in /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-content/themes/zakra/inc/woocommerce.php:155
    Stack trace:
    #0 /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-content/themes/zakra/inc/woocommerce.php(183): zakra_woocommerce_cart_link()
    #1 /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-includes/class-wp-hook.php(303): zakra_woocommerce_header_cart('')
    #2 /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-includes/plugin.php(189): WP_Hook->apply_filters('', Array)
    #3 /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-content/themes/zakra/inc/template-functions.php(405): apply_filters('zakra_woocommer...', '')
    #4 /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-includes/class-wp-hook.php(303): zakra_insert_primary_menu_item('<li id="menu-it...', Object(stdClass))
    #5 /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-includes/plugin.php(189): WP_Hook in /var/www/vhosts/server/pexlechris.dev/library-viewer/wp-content/themes/zakra/inc/woocommerce.php on line 155

    I got this error, why?
    can you fix it please?

    Woo version: 5.5.3
    Elementor: 3.3.1
    Zakra: 2.0.1

    • This topic was modified 3 years ago by Pexle Chris. Reason: Plugins' Details

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @pexlechris,

    Thank you for writing in,

    I suspect one of the plugins you’re using might be causing the problem, so please try deactivating all the plugins one by one and check if the problem resolves.
    Let me know if this helps you or not and I will get back to you.

    With Regards,
    Zakra Support Team

    Thread Starter Pexle Chris

    (@pexlechris)

    I cannot reproduce the error…
    The error didn’t happened when I was browsing the website.
    I saw the error in the logs and I shared it to you…

    The 155 line is this: WC()->cart->get_cart_contents_count()
    How can WC()->cart to be null?

    Also, this is called by function zakra_woocommerce_cart_link.

    
    if ( ! function_exists( 'zakra_woocommerce_cart_link' ) ) {
    	/**
    	 * Cart Link.
    	 *
    	 * Displayed a link to the cart including the number of items present and the cart total.
    	 *
    	 * @return string
    	 */
    	function zakra_woocommerce_cart_link() {
    
    		$output          = '';
    		$output          .= '<a class="cart-page-link" href="' . esc_url( wc_get_cart_url() ) . '" title="' . __( 'View your shopping cart', 'zakra' ) . '">';
    		$item_count_text = sprintf(
    		/* translators: number of items in the mini cart. */
    			'%d',
    			WC()->cart->get_cart_contents_count()
    		);
    		$output          .= '<i class="tg-icon tg-icon-shopping-cart"></i>';
    		$output          .= '<span class="count">' . esc_html( $item_count_text ) . '</span>';
    		$output          .= '</a>';
    
    		return $output;
    
    	}
    }

    Where this function is called? In which page?

    Hi @pexlechris,

    Thank you for writing in,

    Can you please contact us via live chat support at https://zakratheme.com/ and we’ll discuss it further?

    With Regards,
    Zakra Support Team

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatar Error Woocommerce’ is closed to new replies.