Open mactez opened 3 years ago
Hi, I've encountered the same issue and I solved it. It's happened when a logged-in user complete an order and then delete it permanently. Then the same user going to make another orders and there'll be a problem. Since the order was deleted but it's still in cache, the woocommerce will just simply throw an Exception out and the fatal error occurs.
And what I did is, well not perfectly, just add a return statement before it throws Exception in the file abstract-wc-order-data-store-cpt.php in line 104:
As-Is
if ( ! $order->get_id() || ! $post_object || ! in_array( $post_object->post_type, wc_get_order_types(), true ) ) {
throw new Exception( __( 'Invalid order.', 'woocommerce' ) );
}
To-Be
if ( ! $order->get_id() || ! $post_object || ! in_array( $post_object->post_type, wc_get_order_types(), true ) ) {
// ========== Modified By Hayato ==========
return;
// ========================================
throw new Exception( __( 'Invalid order.', 'woocommerce' ) );
}
And the fatal error message will disappear.
W checkoucie wywala następujący błąd:
Fatal error: Uncaught Exception: Nieprawidłowe zamówienie. in /home/onlinere/domains/onlinerecepta.pl/public_html/wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php:105 Stack trace: #0 /home/onlinere/domains/onlinerecepta.pl/public_html/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(159): Abstract_WC_Order_Data_Store_CPT->read(Object(WC_Order)) #1 /home/onlinere/domains/onlinerecepta.pl/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php(112): WC_Data_Store->read(Object(WC_Order)) #2 /home/onlinere/domains/onlinerecepta.pl/public_html/wp-content/plugins/woocommerce-dotpay/Dotpay/Payment.php(1368): WC_Abstract_Order->__construct(4504) #3 /home/onlinere/domains/onlinerecepta.pl/public_html/wp-content/plugins/woocommerce-dotpay/Dotpay/Payment.php(334): Dotpay_Payment->getOrder() #4 /home/onlinere/domains/onlinerecepta.pl/public_html/wp-content/plugins/woocommerce-dotpay/form/standard.phtml(47): Dotpay_Payment->getAmountForWidget() #5 /ho in /home/onlinere/domains/onlinerecepta.pl/public_html/wp-content/plugins/woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php on line 105 W witrynie wystąpił błąd krytyczny.
Wersja wordpress 5.5.1 wersja woocommerce 4.6.1