Stop check again if coupon have code when creating

This commit is contained in:
Claudio Sanches 2016-03-29 19:09:55 -03:00
parent d781e10d63
commit a0290a6c65
1 changed files with 0 additions and 7 deletions

View File

@ -177,13 +177,6 @@ class WC_REST_Coupons_Controller extends WC_REST_Posts_Controller {
$schema = $this->get_item_schema();
// Validate required POST fields.
if ( 'POST' === $request->get_method() && empty( $data->ID ) ) {
if ( empty( $request['code'] ) ) {
return new WP_Error( 'woocommerce_rest_missing_parameter', sprintf( __( 'Missing parameter %s.', 'woocommerce' ), 'code' ), array( 'status' => 400 ) );
}
}
// Code.
if ( ! empty( $schema['properties']['code'] ) && ! empty( $request['code'] ) ) {
$coupon_code = apply_filters( 'woocommerce_coupon_code', $request['code'] );