Applies wc_delete_order_note() and properly delete notes by AJAX
This commit is contained in:
parent
97f9dab0ce
commit
eb4caec13e
|
@ -1444,7 +1444,7 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
}
|
||||
|
||||
// Force delete since trashed order notes could not be managed through comments list table
|
||||
$result = wp_delete_comment( $note->comment_ID, true );
|
||||
$result = wc_delete_order_note( $note->comment_ID );
|
||||
|
||||
if ( ! $result ) {
|
||||
throw new WC_API_Exception( 'woocommerce_api_cannot_delete_order_note', __( 'This order note cannot be deleted', 'woocommerce' ), 500 );
|
||||
|
|
|
@ -1491,7 +1491,7 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
}
|
||||
|
||||
// Force delete since trashed order notes could not be managed through comments list table
|
||||
$result = wp_delete_comment( $note->comment_ID, true );
|
||||
$result = wc_delete_order_note( $note->comment_ID );
|
||||
|
||||
if ( ! $result ) {
|
||||
throw new WC_API_Exception( 'woocommerce_api_cannot_delete_order_note', __( 'This order note cannot be deleted', 'woocommerce' ), 500 );
|
||||
|
|
|
@ -310,7 +310,7 @@ class WC_REST_Order_Notes_V1_Controller extends WC_REST_Controller {
|
|||
$request->set_param( 'context', 'edit' );
|
||||
$response = $this->prepare_item_for_response( $note, $request );
|
||||
|
||||
$result = wp_delete_comment( $note->comment_ID, true );
|
||||
$result = wc_delete_order_note( $note->comment_ID );
|
||||
|
||||
if ( ! $result ) {
|
||||
return new WP_Error( 'woocommerce_rest_cannot_delete', sprintf( __( 'The %s cannot be deleted.', 'woocommerce' ), 'order_note' ), array( 'status' => 500 ) );
|
||||
|
|
|
@ -1137,7 +1137,7 @@ class WC_AJAX {
|
|||
$note_id = (int) $_POST['note_id'];
|
||||
|
||||
if ( $note_id > 0 ) {
|
||||
wp_delete_comment( $note_id );
|
||||
wc_delete_order_note( $note_id );
|
||||
}
|
||||
wp_die();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue