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

Uncaught Error: Class 'WC_Name_Your_Price_Helpers' not found #2361

Open
gusaus opened this issue Mar 20, 2023 · 2 comments
Open

Uncaught Error: Class 'WC_Name_Your_Price_Helpers' not found #2361

gusaus opened this issue Mar 20, 2023 · 2 comments

Comments

@gusaus
Copy link

gusaus commented Mar 20, 2023

Describe the bug
We recently switched the Reader Revenue Platform from Newspack to Stripe on a customer site. After disabling WooCommerce Name Your Price and WooCommerce Subscriptions, we noticed the following error on the cart page.

Cart - Angel City Jazz 2023-03-20 14-52-56

This is how it reads in the WooCommerce Logs -

Fatal error: Uncaught Error: Class 'WC_Name_Your_Price_Helpers' not found in /code/wp-content/plugins/newspack-plugin/includes/class-donations.php:243 Stack trace: #0 /code/wp-content/plugins/newspack-plugin/includes/class-donations.php(963): Newspack\Donations::get_donation_product_child_products_ids() #1 /code/wp-includes/class-wp-hook.php(308): Newspack\Donations::handle_cart('') #2 /code/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #3 /code/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /code/wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-cart.php(91): do_action('woocommerce_che...') #5 /code/wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php(72): WC_Shortcode_Cart::output(Array) #6 /code/wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php(85): WC_Shortcodes::shortcode_wrapper(Array) #7 /code/wp-includes/shortcodes.php(355): WC_Shortcodes::cart('', '', 'woocommerce_car...') #8 [internal function]: do_shortcode_tag(Array) #9 /code/wp- in /code/wp-content/plugins/newspack-plugin/includes/class-donations.php on line 243

Considering the error went away after re-enabling the plugins, we're assuming there's some sort of leftover dependency?

Not surprisingly we could 'not' replicate on a clean install where Stripe was the Reader Revenue platform from the start (and did not install/enable Subscriptions and Name Your Price.

@davisshaver
Copy link
Contributor

This seems to still be an issue. I added some additional checks in the init function.

		if (
			! is_admin() &&
			class_exists( 'WC_Name_Your_Price_Helpers' ) &&
			function_exists( 'WC' ) &&
			class_exists( 'WC_Subscriptions_Product' )
		) {

@gusaus
Copy link
Author

gusaus commented Feb 9, 2024

I'm assuming this isn't an issue on the Newspack hosted service but most (all?) self hosted environments are affected, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants