| @@ -195,20 +195,8 @@ | ||
| 195 | 195 | ); |
| 196 | 196 | |
| 197 | 197 | register_rest_route( |
| 198 | 198 | self::NS, |
| 199 | - '/plans/product-user-cancel/(?P<id>\d+)', | |
| 200 | - array( | |
| 201 | - array( | |
| 202 | - 'methods' => WP_REST_Server::EDITABLE, | |
| 203 | - 'callback' => array( $this, 'save_product_user_cancel' ), | |
| 204 | - 'permission_callback' => $perm, | |
| 205 | - ), | |
| 206 | - ) | |
| 207 | - ); | |
| 208 | - | |
| 209 | - register_rest_route( | |
| 210 | - self::NS, | |
| 211 | 199 | '/plans/group-products/(?P<id>\d+)', |
| 212 | 200 | array( |
| 213 | 201 | array( |
| 214 | 202 | 'methods' => WP_REST_Server::READABLE, |
| @@ -655,34 +643,8 @@ | ||
| 655 | 643 | 'deleted' => true, |
| 656 | 644 | 'id' => $id, |
| 657 | 645 | ) |
| 658 | 646 | ); |
| 659 | - } | |
| 660 | - | |
| 661 | - /** | |
| 662 | - * PUT /plans/product-user-cancel/{id} - save whether customers may cancel. | |
| 663 | - * | |
| 664 | - * Writes the same `_subscrpt_user_cancel` meta the product editor saves, as | |
| 665 | - * an explicit "yes" / "no", which checkout copies onto each new subscription. | |
| 666 | - * | |
| 667 | - * Body: { enabled: bool }. | |
| 668 | - * | |
| 669 | - * @param WP_REST_Request $request Request. | |
| 670 | - * | |
| 671 | - * @return \WP_REST_Response|WP_Error | |
| 672 | - */ | |
| 673 | - public function save_product_user_cancel( WP_REST_Request $request ) { | |
| 674 | - $product = function_exists( 'wc_get_product' ) ? wc_get_product( (int) $request['id'] ) : null; | |
| 675 | - | |
| 676 | - if ( ! $product ) { | |
| 677 | - return $this->not_found(); | |
| 678 | - } | |
| 679 | - | |
| 680 | - $params = $this->read_params( $request ); | |
| 681 | - $product->update_meta_data( '_subscrpt_user_cancel', empty( $params['enabled'] ) ? 'no' : 'yes' ); | |
| 682 | - $product->save(); | |
| 683 | - | |
| 684 | - return rest_ensure_response( array( 'saved' => true ) ); | |
| 685 | 647 | } |
| 686 | 648 | |
| 687 | 649 | /** |
| 688 | 650 | * POST /plans/bulk-price - set one price on many product/duration relations. |