|
@@ 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'] ) ) { |
|
@@ 958-960 (lines=3) @@
|
| 955 |
|
} |
| 956 |
|
|
| 957 |
|
// quantity is required when creating |
| 958 |
|
if ( $creating && ! isset( $item['quantity'] ) ) { |
| 959 |
|
throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_quantity', __( 'Product quantity is required', 'woocommerce' ) ); |
| 960 |
|
} |
| 961 |
|
|
| 962 |
|
$item_args = array(); |
| 963 |
|
|
|
@@ 1075-1077 (lines=3) @@
|
| 1072 |
|
protected function set_shipping( $order, $shipping, $action ) { |
| 1073 |
|
|
| 1074 |
|
// total must be a positive float |
| 1075 |
|
if ( isset( $shipping['total'] ) && floatval( $shipping['total'] ) < 0 ) { |
| 1076 |
|
throw new WC_CLI_Exception( 'woocommerce_invalid_shipping_total', __( 'Shipping total must be a positive amount', 'woocommerce' ) ); |
| 1077 |
|
} |
| 1078 |
|
|
| 1079 |
|
if ( 'create' === $action ) { |
| 1080 |
|
|
|
@@ 1211-1213 (lines=3) @@
|
| 1208 |
|
protected function set_coupon( $order, $coupon, $action ) { |
| 1209 |
|
|
| 1210 |
|
// coupon amount must be positive float. |
| 1211 |
|
if ( isset( $coupon['amount'] ) && floatval( $coupon['amount'] ) < 0 ) { |
| 1212 |
|
throw new WC_CLI_Exception( 'woocommerce_invalid_coupon_total', __( 'Coupon discount total must be a positive amount', 'woocommerce' ) ); |
| 1213 |
|
} |
| 1214 |
|
|
| 1215 |
|
if ( 'create' === $action ) { |
| 1216 |
|
|