I use WP All Import, and I use this code to exchange the course. I would like to make a discount randomly at the same time after converting it to my currency.
This is the code
function add_exchangerate($x) {
$markup = 20;
$y = $x * $markup;
return $y;
}
What can I add to it to make it, for example, every 20th time that it launches this function, it will make a discount, maybe 13%?
thought about adding
$i = 1;
$i++
$xnum = mt_rand(1,1000)
while ($x = $xnum) {
$z = $x/1.15
return $z
}
source
share