• Resolved rumpelstilzchen94

    (@rumpelstilzchen94)


    My error_log is quite big (2GB) and I get the following error a few times a day:

    Fatal error: Call to a member function get_cart_subtotal() on null in /home/abc/www.link.to/wp-content/themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php on line 77

    Line 73-81 of the storefront-woocommerce-template-functions.php file:

    function storefront_cart_link() {
    		?>
    			<a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', 'storefront' ); ?>">
    				<?php /* translators: %d: number of items in cart */ ?>
    				<?php echo wp_kses_post( WC()->cart->get_cart_subtotal() ); ?> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'storefront' ), WC()->cart->get_cart_contents_count() ) ); ?></span>
    			</a>
    		<?php
    	}
    }

    Any idea what could cause the error?
    Wordpress, Woocommerce, Storefront is up to date.

Viewing 1 replies (of 1 total)
  • Looks like another user of the Storefront theme filed a bug report recently about this error here:

    https://github.com/woocommerce/woocommerce/issues/24261

    Based upon their replication methods, it doesn’t look like it would cause any issues and may just be bots/etc causing the error to trigger. You may want to try reproducing the issue mentioned on that report and check your error log to see if it shows up as well.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP Fatal Error’ is closed to new replies.