• Resolved butchler

    (@butchler)


    The following error is thrown when trying to open the block editor for a post on my self-hosted wordpress site:

    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:1306
    Stack 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, 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

    (@jigneshmpatel)

    Hello @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

    (@jigneshmpatel)

    Hello @butchler,

    We have included a fix for the issue you reported in this version : Download Link

    Please try this and let us know if issue resolved for you.

    Best Regards

    Thread Starter butchler

    (@butchler)

    Thank you! I tried it out and the fix seem to work. 👍

    Plugin Support Jignesh

    (@jigneshmpatel)

    Hello @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.

    Best Regards

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

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