Untitled

 avatar
unknown
plain_text
3 months ago
584 B
6
Indexable
function leukaditis_gtc($product_price) {
  if ($product_price > 299) {
    // If price is greater than 299, apply a fixed €2.99 reduction
    $reduced_price = $product_price - 2.99;
  } elseif ($product_price <= 299) {
    // If price is 299 or less, apply a 1% reduction
    $reduced_price = $product_price * 0.99;

    // Ensure the reduction does not exceed €2.99
    if (($product_price - $reduced_price) > 2.99) {
      $reduced_price = $product_price - 2.99;
    }
  }

  // Ensure proper rounding to two decimal places
  return number_format($reduced_price, 2, '.', '');
}
Editor is loading...
Leave a Comment