Skip to content

Commit

Permalink
Simplified CartApplyCoupon::get_post_route_response()
Browse files Browse the repository at this point in the history
  • Loading branch information
wavvves committed Mar 6, 2024
1 parent 35d96f0 commit 43f185b
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,10 @@ protected function get_route_post_response( \WP_REST_Request $request ) {

$coupon_code = wc_format_coupon_code( wp_unslash( $request['code'] ) );

try {
$this->cart_controller->apply_coupon( $coupon_code );
} catch ( \WC_REST_Exception $e ) {
throw new RouteException( $e->getErrorCode(), $e->getMessage(), $e->getCode() );
}
$this->cart_controller->apply_coupon( $coupon_code );

$cart = $this->cart_controller->get_cart_instance();

return rest_ensure_response( $this->schema->get_item_response( $cart ) );
}
}

0 comments on commit 43f185b

Please sign in to comment.