Skip to content

Commit 553d847

Browse files
committed
Clarify that decimal ratios for coupons and refunds are converted to percentages using integer rounding
1 parent 20f415b commit 553d847

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ Generate orders with a specific status.
3535
- `wp wc generate orders <nr of orders> --status=completed`
3636

3737
Apply coupons to a percentage of generated orders (0.0-1.0). If no coupons exist, 6 will be created automatically (3 fixed cart, 3 percentage). Note: `--coupons` flag is equivalent to `--coupon-ratio=1.0`.
38+
39+
**Important:** Decimal ratios are converted to percentages using integer rounding. For example, `0.505` becomes 50% (not 50.5%) because the random generation uses integer comparison. Use whole percentages like `0.50` for precise 50% ratios.
3840
- `wp wc generate orders <nr of orders> --coupon-ratio=0.5`
3941

4042
Refund a percentage of completed orders (0.0-1.0). Refunds will be split evenly between partial and full, and 25% of partial refunds will receive a second partial refund.
43+
44+
**Note:** The same decimal ratio behavior applies to refund ratios as described above for coupon ratios.
4145
- `wp wc generate orders <nr of orders> --status=completed --refund-ratio=0.3`
4246

4347
#### Order Attribution

includes/CLI.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,13 @@ function () use ( $progress ) {
322322
array(
323323
'name' => 'coupon-ratio',
324324
'type' => 'assoc',
325-
'description' => 'Decimal ratio (0.0-1.0) of orders that should have coupons applied. If no coupons exist, 6 will be created (3 fixed value, 3 percentage).',
325+
'description' => 'Decimal ratio (0.0-1.0) of orders that should have coupons applied. If no coupons exist, 6 will be created (3 fixed value, 3 percentage). Note: Decimal values are converted to percentages using integer rounding (e.g., 0.505 becomes 50%).',
326326
'optional' => true,
327327
),
328328
array(
329329
'name' => 'refund-ratio',
330330
'type' => 'assoc',
331-
'description' => 'Decimal ratio (0.0-1.0) of completed orders that should be refunded (wholly or partially).',
331+
'description' => 'Decimal ratio (0.0-1.0) of completed orders that should be refunded (wholly or partially). Note: Decimal values are converted to percentages using integer rounding (e.g., 0.505 becomes 50%).',
332332
'optional' => true,
333333
),
334334
array(

0 commit comments

Comments
 (0)