Title: Error thrown when opening block editor
Last modified: September 26, 2025

---

# Error thrown when opening block editor

 *  Resolved [butchler](https://wordpress.org/support/users/butchler/)
 * (@butchler)
 * [8 months, 2 weeks ago](https://wordpress.org/support/topic/error-throw-when-opening-block-editor/)
 * The following error is thrown when trying to open the block editor for a post
   on my self-hosted wordpress site:
 *     ```wp-block-code
       Error Details=============An error of type E_ERROR was caused in line 1306 of the file /<site root directory>/www/wordpress/wp-content/plugins/woo-paypal-gateway/ppcp/public/class-ppcp-paypal-checkout-for-woocommerce-button-manager.php. Error message: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /<site root directory>/www/wordpress/wp-content/plugins/woo-paypal-gateway/ppcp/public/class-ppcp-paypal-checkout-for-woocommerce-button-manager.php:1306Stack trace:#0 /<site root directory>/www/wordpress/wp-content/plugins/woo-paypal-gateway/ppcp/public/class-ppcp-paypal-checkout-for-woocommerce-button-manager.php(1306): method_exists(NULL, 'needs_shipping')#1 /<site root directory>/www/wordpress/wp-includes/class-wp-hook.php(324): PPCP_Paypal_Checkout_For_Woocommerce_Button_Manager->filter_default_address_fields(Array)#2 /<site root directory>/www/wordpress/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)#3 /<site root directory>/www/wordpress/wp-content/plugins/woocommerce/includes/class-wc-countries.php(823): apply_filters('woocommerce_def...', Array)#4 /<site root directory>/www/wordpress/wp-content/plugins/woocommerce/includes/class-wc-countries.php(1672): WC_Countries->get_default_address_fields()#5 /<site root directory>/www/wordpress/wp-content/plugins/woocommerce/src/Blocks/Utils/CartCheckoutUtils.php(346): WC_Countries->get_country_locale()#6 /<site root directory>/www/wordpress/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/Cart.php(237): Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils::get_country_data()#7 /<site root directory>/www/wordpress/wp-content/plugins/woocommerce/src/Blocks/BlockTypes/AbstractBlock.php(111): Automattic\WooCommerce\Blocks\BlockTypes\Cart->enqueue_data()#8 /<site root directory>/www/wordpress/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\BlockTypes\AbstractBlock->enqueue_editor_assets('')#9 /<site root directory>/www/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)#10 /<site root directory>/www/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action(Array)#11 /<site root directory>/www/wordpress/wp-admin/edit-form-blocks.php(339): do_action('enqueue_block_e...')#12 /<site root directory>/www/wordpress/wp-admin/post.php(187): require('/...')#13 {main}  thrown 
       ```
   
 * Looking at the [line of code](https://plugins.trac.wordpress.org/browser/woo-paypal-gateway/trunk/ppcp/public/class-ppcp-paypal-checkout-for-woocommerce-button-manager.php#L1306),
   it seems like the woocommerce card is null when the code expects it to not be
   null:
 * `**if** (method_exists(WC()**->**cart, 'needs_shipping') **&&** **!**WC()**->**
   cart**->**needs_shipping()) {`
 * I’m not sure if the problem is that this code just needs to check if the cart
   is null, or if the problem is that the cart should not be null in this case. 
   Or maybe it’s an entirely different problem (e.g. maybe this code shouldn’t be
   run when loading the block editor in the first place).
 * Any help debugging the issue is appreciated. 🙇

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Jignesh](https://wordpress.org/support/users/jigneshmpatel/)
 * (@jigneshmpatel)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/error-throw-when-opening-block-editor/#post-18658594)
 * Hello [@butchler](https://wordpress.org/support/users/butchler/)
 * Thank you for providing detailed information about the issue. I am currently 
   investigating and attempting to reproduce the problem on my end. I will update
   you as soon as I have more insights or a solution.
 * Thank you for your patience.
 * Best regards
 *  Plugin Support [Jignesh](https://wordpress.org/support/users/jigneshmpatel/)
 * (@jigneshmpatel)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/error-throw-when-opening-block-editor/#post-18659979)
 * Hello [@butchler](https://wordpress.org/support/users/butchler/), 
   We have included
   a fix for the issue you reported in this version : [Download Link](https://drive.google.com/file/d/120UOmEsJrHoOkhzosI_UY98RTXzcxz_5/view)
 * Please try this and let us know if issue resolved for you.
 * Best Regards
 *  Thread Starter [butchler](https://wordpress.org/support/users/butchler/)
 * (@butchler)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/error-throw-when-opening-block-editor/#post-18661472)
 * Thank you! I tried it out and the fix seem to work. 👍
 *  Plugin Support [Jignesh](https://wordpress.org/support/users/jigneshmpatel/)
 * (@jigneshmpatel)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/error-throw-when-opening-block-editor/#post-18661513)
 * Hello [@butchler](https://wordpress.org/support/users/butchler/),
    Glad to hear
   that it’s working now!
 * If you have any other questions or need further assistance, feel free to reach
   out anytime. If you have a moment, I would love it if you could [leave a review](https://wordpress.org/support/plugin/woo-paypal-gateway/reviews/#new-post).
 * Best Regards

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Error thrown when opening block editor’ is closed to new replies.

 * ![](https://ps.w.org/woo-paypal-gateway/assets/icon-256x256.png?rev=3275768)
 * [Payment Gateway for PayPal on WooCommerce](https://wordpress.org/plugins/woo-paypal-gateway/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woo-paypal-gateway/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woo-paypal-gateway/)
 * [Active Topics](https://wordpress.org/support/plugin/woo-paypal-gateway/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woo-paypal-gateway/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woo-paypal-gateway/reviews/)

## Tags

 * [paypal](https://wordpress.org/support/topic-tag/paypal/)

 * 4 replies
 * 2 participants
 * Last reply from: [Jignesh](https://wordpress.org/support/users/jigneshmpatel/)
 * Last activity: [8 months, 1 week ago](https://wordpress.org/support/topic/error-throw-when-opening-block-editor/#post-18661513)
 * Status: resolved