Fatal Error
-
Hi,
When I start the email editor this error comes upFatal error: Uncaught Exception: Invalid order. in /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:104 Stack trace: #0 /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(159): Abstract_WC_Order_Data_Store_CPT->read() #1 /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php(114): WC_Data_Store->read() #2 /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()'d code(205): WC_Abstract_Order->__construct() #3 /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-includes/class-wp-hook.php(305): rfvc_update_order_status() #4 /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-includes/plugin.php(189): WP_Hook->apply_filters() #5 /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-content/plugins/woocommerce/includes/cla in /srv/www/vhosts/pebwebcdn.ch/subdomains/bffl/httpdocs/wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php on line 104
I found that this crash comes from a code snippet I use, to set the orders directely to completed, because I sell digital products. The snippet:
`add_filter( ‘woocommerce_payment_complete_order_status’, ‘rfvc_update_order_status’, 10, 2 );
function rfvc_update_order_status( $order_status, $order_id ) {
$order = new WC_Order( $order_id );
if ( ‘processing’ == $order_status && ( ‘on-hold’ == $order->status || ‘pending’ == $order->status || ‘failed’ == $order->status ) ) {
return ‘completed’;
}
return $order_status;
}Do you have any idea how I can solve this? I tried to put the priority of the snippet to 20 and to 5 but no luck.
- The topic ‘Fatal Error’ is closed to new replies.