Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical Error in woocommerce.php Causing Blank Orders in WooCommerce #912

Open
grownlocal opened this issue May 27, 2024 · 0 comments
Open
Labels
[Type] Bug Something that is not working as expected

Comments

@grownlocal
Copy link

Summary of WooCommerce Issue

We are experiencing blank orders in WooCommerce due to a critical error in the theme’s woocommerce.php file. Below are the key details and steps taken to investigate and mitigate the issue:

Error Details:

•	Error Message:

Uncaught Error: Call to a member function get_cart_contents_count() on null in /var/www/vhosts/grownlocal.co.uk/httpdocs/wp-content/themes/go/includes/woocommerce.php:361

•	File and Line: woocommerce.php at line 361.
•	Description: The error occurs when get_cart_contents_count() is called on a null value, indicating improper initialization of the WooCommerce cart object.

Steps Taken:

1.	Temporary Fix:

We added a check to ensure the cart object is not null before calling get_cart_contents_count():

if ( WC()->cart ) {
$cart_count = WC()->cart->get_cart_contents_count();
} else {
$cart_count = 0;
}

@grownlocal grownlocal added the [Type] Bug Something that is not working as expected label May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Something that is not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant