wp_insert_post should have true as $wp_error parameter

Add `true` as $wp_error parameter for wp_insert_post, otherwise it returns zero instead of a WP_Error object and the checkout process is not stopped.

@mikejolley - the messages from WP_Error are not displayed or logged, making debugging this difficult. Maybe we should check WP_DEBUG and display the message if it is set to true? either that or actually use the logger in WooCommerce for the first time?
This commit is contained in:
Patrick Garman 2013-09-24 16:08:32 -05:00
parent 66adf51e67
commit 1292a9f51a
1 changed files with 1 additions and 1 deletions

View File

@ -213,7 +213,7 @@ class WC_Checkout {
}
if ( $create_new_order ) {
$order_id = wp_insert_post( $order_data );
$order_id = wp_insert_post( $order_data, true );
if ( is_wp_error( $order_id ) )
throw new Exception( 'Error: Unable to create order. Please try again.' );