| @@ 464-475 (lines=12) @@ | ||
| 461 | * @param bool $force true to permanently delete coupon, false to move to trash |
|
| 462 | * @return array |
|
| 463 | */ |
|
| 464 | public function delete_coupon( $id, $force = false ) { |
|
| 465 | ||
| 466 | $id = $this->validate_request( $id, 'shop_coupon', 'delete' ); |
|
| 467 | ||
| 468 | if ( is_wp_error( $id ) ) { |
|
| 469 | return $id; |
|
| 470 | } |
|
| 471 | ||
| 472 | do_action( 'woocommerce_api_delete_coupon', $id, $this ); |
|
| 473 | ||
| 474 | return $this->delete( $id, 'shop_coupon', ( 'true' === $force ) ); |
|
| 475 | } |
|
| 476 | ||
| 477 | /** |
|
| 478 | * expiry_date format |
|
| @@ 695-708 (lines=14) @@ | ||
| 692 | * @param bool $force true to permanently delete order, false to move to trash |
|
| 693 | * @return array |
|
| 694 | */ |
|
| 695 | public function delete_order( $id, $force = false ) { |
|
| 696 | ||
| 697 | $id = $this->validate_request( $id, $this->post_type, 'delete' ); |
|
| 698 | ||
| 699 | if ( is_wp_error( $id ) ) { |
|
| 700 | return $id; |
|
| 701 | } |
|
| 702 | ||
| 703 | wc_delete_shop_order_transients( $id ); |
|
| 704 | ||
| 705 | do_action( 'woocommerce_api_delete_order', $id, $this ); |
|
| 706 | ||
| 707 | return $this->delete( $id, 'order', ( 'true' === $force ) ); |
|
| 708 | } |
|
| 709 | ||
| 710 | /** |
|
| 711 | * Helper method to get order post objects |
|
| @@ 444-457 (lines=14) @@ | ||
| 441 | * @param int $id the customer ID |
|
| 442 | * @return array |
|
| 443 | */ |
|
| 444 | public function delete_customer( $id ) { |
|
| 445 | ||
| 446 | // Validate the customer ID. |
|
| 447 | $id = $this->validate_request( $id, 'customer', 'delete' ); |
|
| 448 | ||
| 449 | // Return the validate error. |
|
| 450 | if ( is_wp_error( $id ) ) { |
|
| 451 | return $id; |
|
| 452 | } |
|
| 453 | ||
| 454 | do_action( 'woocommerce_api_delete_customer', $id, $this ); |
|
| 455 | ||
| 456 | return $this->delete( $id, 'customer' ); |
|
| 457 | } |
|
| 458 | ||
| 459 | /** |
|
| 460 | * Get the orders for a customer |
|