Files
Additional/app/Services/ShippingService.php
T
2025-12-30 10:40:45 +02:00

46 lines
1.0 KiB
PHP

<?php
namespace App\Services;
use App\Models\AppSetting;
class ShippingService
{
/**
* Calculate shipping fee based on order subtotal
*/
public static function calculateShippingFee(float $subtotal): float
{
$freeShippingThreshold = AppSetting::get('free_shipping_threshold', 2000);
if ($subtotal >= $freeShippingThreshold) {
return 0;
}
$localShipping = AppSetting::get('local_shipping', 200);
return $localShipping;
}
/**
* Get shipping label based on order subtotal
*/
public static function getShippingLabel(float $subtotal): string
{
$freeShippingThreshold = AppSetting::get('free_shipping_threshold', 2000);
if ($subtotal >= $freeShippingThreshold) {
return 'Free Shipping';
}
return 'Local Delivery';
}
/**
* Get sample cost
*/
public static function getSampleCost(): float
{
return AppSetting::get('sample_cost', 80);
}
}