@@ 585-587 (lines=3) @@ | ||
582 | } |
|
583 | ||
584 | // Quantity must be positive float. |
|
585 | if ( isset( $item['quantity'] ) && 0 >= floatval( $item['quantity'] ) ) { |
|
586 | throw new WC_REST_Exception( 'woocommerce_rest_invalid_product_quantity', __( 'Product quantity must be a positive float.', 'woocommerce' ), 400 ); |
|
587 | } |
|
588 | ||
589 | // Quantity is required when creating. |
|
590 | if ( $creating && ! isset( $item['quantity'] ) ) { |
|
@@ 590-592 (lines=3) @@ | ||
587 | } |
|
588 | ||
589 | // Quantity is required when creating. |
|
590 | if ( $creating && ! isset( $item['quantity'] ) ) { |
|
591 | throw new WC_REST_Exception( 'woocommerce_rest_invalid_product_quantity', __( 'Product quantity is required.', 'woocommerce' ), 400 ); |
|
592 | } |
|
593 | ||
594 | // Get variation attributes. |
|
595 | if ( method_exists( $product, 'get_variation_attributes' ) ) { |
|
@@ 771-773 (lines=3) @@ | ||
768 | */ |
|
769 | protected function set_coupon( $order, $coupon, $action ) { |
|
770 | // Coupon discount must be positive float. |
|
771 | if ( isset( $coupon['discount'] ) && 0 > floatval( $coupon['discount'] ) ) { |
|
772 | throw new WC_REST_Exception( 'woocommerce_rest_invalid_coupon_total', __( 'Coupon discount must be a positive amount.', 'woocommerce' ), 400 ); |
|
773 | } |
|
774 | ||
775 | if ( 'create' === $action ) { |
|
776 | // Coupon code is required. |
@@ 953-955 (lines=3) @@ | ||
950 | } |
|
951 | ||
952 | // quantity must be positive float |
|
953 | if ( isset( $item['quantity'] ) && floatval( $item['quantity'] ) <= 0 ) { |
|
954 | throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_quantity', __( 'Product quantity must be a positive float', 'woocommerce' ) ); |
|
955 | } |
|
956 | ||
957 | // quantity is required when creating |
|
958 | if ( $creating && ! isset( $item['quantity'] ) ) { |