• Resolved pottypotsworth

    (@pottypotsworth)


    Hello,

    All posts on my site are failing to save when updated, and new ones are not saved when created. My web hosts were able to report the following.

    I was able to find the cause of the update error. It is related to one of your plugins – woo-gutenberg-products-block (WooCommerce Blocks).
    It seems the plugin is blocking REST API and thus the update failed.

    Here is the error as well:
    ===================================================================
    When testing the REST API, an unexpected result was returned:
    REST API Endpoint: https://www.prettyme.ph/wp-json/wp/v2/types/post?context=edit
    REST API Response: (500) Internal Server Error
    ===================================================================

    Once the plugin has been disabled I was able to update the changes on the page.
    The plugin is currently enabled as you requested earlier.

    I locate Stack trace in the error log which is related.
    I will share it with you with advice to contact the plugin support/developers for further insights on what may cause the issue:

    ===================================================================
    PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /home/prettyme/public_html/wp-content/themes/legenda-child/functions.php:170\n
    Stack trace:
    \n#0 /home/prettyme/public_html/wp-includes/class-wp-hook.php(308):
    bbloomer_gateway_disable_shipping_326()\n#1
    /home/prettyme/public_html/wp-includes/plugin.php(205):
    WP_Hook->apply_filters()\n#2
    /home/prettyme/public_html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(163):
    apply_filters()\n#3
    /home/prettyme/public_html/wp-content/plugins/woo-gutenberg-products-block/src/StoreApi/Schemas/V1/CheckoutSchema.php(122):
    WC_Payment_Gateways->get_available_payment_gateways()\n#4
    /home/prettyme/public_html/wp-content/plugins/woo-gutenberg-products-block/src/StoreApi/Schemas/V1/AbstractSchema.php(62):
    Automattic\WooCommerce\StoreApi\Schemas\V1\CheckoutSchema->get_properties()\n#5 /home/prettyme/public_html/wp-content/plugins/woo-gutenberg-products-block/src/StoreApi/Routes/V1/AbstractRoute.php(85):
    Automattic\WooCommerce\StoreApi\Schemas\V1\AbstractSchem in /home/prettyme/public_html/wp-content/themes/legenda-child/functions.php on line 170\n

    ===================================================================

    Disabling the plugin allows posts to be saved again.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi there! It’s great that you were immediately able to workaround the problem by deactivating WooCommerce Blocks, from the stack trace it’s not Woo Blocks that is actually triggering the fatal error. Something in your themes functions.php file is.

    PHP Fatal error:  Uncaught Error: Call to a member function get() on null in /home/prettyme/public_html/wp-content/themes/legenda-child/functions.php:170\

    It appears whatever is in this theme file is hooking into something within WooCommerce (and via the stack WooCommerce Blocks). My guess (without having access to the relevant code in the theme file) is that this particular function in the theme is assuming a value is available when it isn’t in this context. Since this is a child theme, it may be custom to your site. Have you checked with the developer of the theme to learn more about this function in your theme and see why it would be throwing this error?

    The other possibility is that this portion of your PHP logs applies to a different error happening elsewhere on your site (and not in the context of the issue you are experiencing). One way to rule that out would be to activate WooCommerce Blocks again, and temporarily switch your site’s theme to a WordPress default theme (such as Twenty Twenty Three) and see if you still have the issues. If you do, then we know the stack trace you shared isn’t relevant. If you don’t, then that confirms the theme is the culprit (and the stack trace is for the right context).

    I hope that helps troubleshoot!

    Thread Starter pottypotsworth

    (@pottypotsworth)

    Many thanks for the reply, Darren.

    I will try and troubleshoot this again next week using your advice and report back.

    Thread Starter pottypotsworth

    (@pottypotsworth)

    We managed to get this fixed. It was caused by adding custom code on the functions.php for Disable Payment Gateway For Specific Shipping Method.

    Thanks again for your help, @nerrad

    Hi @pottypotsworth

    You are most welcome and we’re glad that worked! 🙂

    Meanwhile, if you have a moment to spare, we would love it if you could share your thoughts with us by leaving a review or feedback. Your experience and feedback are important to help us improve and ensure we’re always providing the best possible support.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin is blocking REST API, can’t create any new posts’ is closed to new replies.