File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,9 @@ public static function generate( $save = true, $assoc_args = array() ) {
107107 }
108108
109109 // Apply coupon based on ratio
110- if ( $ coupon_ratio > 0 && ( $ coupon_ratio >= 1.0 || ( (float ) wp_rand () / (float ) getrandmax () ) < $ coupon_ratio ) ) {
110+ if ( $ coupon_ratio >= 1.0 ) {
111+ $ include_coupon = true ;
112+ } elseif ( $ coupon_ratio > 0 && wp_rand ( 1 , 100 ) <= ( $ coupon_ratio * 100 ) ) {
111113 $ include_coupon = true ;
112114 } else {
113115 $ include_coupon = false ;
@@ -157,10 +159,9 @@ public static function generate( $save = true, $assoc_args = array() ) {
157159 if ( $ refund_ratio >= 1.0 ) {
158160 // Always refund if ratio is 1.0 or higher
159161 $ should_refund = true ;
160- } elseif ( $ refund_ratio > 0 ) {
162+ } elseif ( $ refund_ratio > 0 && wp_rand ( 1 , 100 ) <= ( $ refund_ratio * 100 ) ) {
161163 // Use random chance for ratios between 0 and 1
162- $ random = (float ) wp_rand () / (float ) getrandmax ();
163- $ should_refund = $ random < $ refund_ratio ;
164+ $ should_refund = true ;
164165 }
165166
166167 if ( $ should_refund ) {
You can’t perform that action at this time.
0 commit comments