Fix conflict
This commit is contained in:
commit
d133d35e27
|
@ -372,6 +372,11 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function create_order( $data ) {
|
public function create_order( $data ) {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
$data = isset( $data['order'] ) ? $data['order'] : array();
|
||||||
|
|
||||||
|
$wpdb->query( 'START TRANSACTION' );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ( ! isset( $data['order'] ) ) {
|
if ( ! isset( $data['order'] ) ) {
|
||||||
|
@ -482,10 +487,14 @@ class WC_API_Orders extends WC_API_Resource {
|
||||||
|
|
||||||
do_action( 'woocommerce_api_create_order', $order->id, $data, $this );
|
do_action( 'woocommerce_api_create_order', $order->id, $data, $this );
|
||||||
|
|
||||||
|
$wpdb->query( 'COMMIT' );
|
||||||
|
|
||||||
return $this->get_order( $order->id );
|
return $this->get_order( $order->id );
|
||||||
|
|
||||||
} catch ( WC_API_Exception $e ) {
|
} catch ( WC_API_Exception $e ) {
|
||||||
|
|
||||||
|
$wpdb->query( 'ROLLBACK' );
|
||||||
|
|
||||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
|
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue