Fatal Error when Refunding via WooCommerce App
-
I am getting the following fatal error when attempting to refund an order via the WooCommerce app. From what I can tell, the error is occuring when attempting to call method “set_status( 201 )” on the $response object on line 219, which is defined as a WP_Error, which is set by the prepare_object_for_response() function on line 217. If WP_Error does not have the set_status() method defined, then why are you attempting to call this method when prepare_object_for_response() only returns WP_Error objects? Also attempting to call the header() method on the same object on line 220, which is also undefined. Both lines 219 and 220 should only call those methods if they are instantiated for the object. Perhaps we can add a check for those methods or something to avoid the fatal error?
PHP message: PHP Fatal error: Uncaught Error: Call to undefined method WP_Error::set_status() in /web/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php:219\nStack trace:\n#0 /web/wp-includes/rest-api/class-wp-rest-server.php(1141): WC_REST_CRUD_Controller->create_item()\n#1 /web/wp-includes/rest-api/class-wp-rest-server.php(988): WP_REST_Server->respond_to_request()\n#2 /web/wp-includes/rest-api/class-wp-rest-server.php(414): WP_REST_Server->dispatch()\n#3 /web/wp-includes/rest-api.php(386): WP_REST_Server->serve_request()\n#4 /web/wp-includes/class-wp-hook.php(311): rest_api_loaded()\n#5 /web/wp-includes/class-wp-hook.php(336): WP_Hook->apply_filters()\n#6 /web/wp-includes/plugin.php(522): WP_Hook->...
- The topic ‘Fatal Error when Refunding via WooCommerce App’ is closed to new replies.