Use WooCommerce store currency for product and order money.
Deploy Ladill Woo Manager / deploy (push) Successful in 35s

Sync currency from the plugin, format product prices and totals with it, and show the store currency on product price fields instead of hard-coding GHS.
This commit is contained in:
isaacclad
2026-07-24 15:38:07 +00:00
parent f7eed690ab
commit e709de6593
9 changed files with 234 additions and 9 deletions
+7 -2
View File
@@ -65,8 +65,13 @@ class WooOrder extends Model
public function totalFormatted(): string
{
$minor = (int) $this->total_minor;
$currency = strtoupper((string) ($this->currency ?: 'GHS'));
$currency = strtoupper(trim((string) ($this->currency ?: '')));
if ($currency === '' && ($this->relationLoaded('store') || $this->store)) {
$currency = $this->store->currency();
}
return $currency.' '.number_format($minor / 100, 2);
$amount = number_format($minor / 100, 2);
return $currency !== '' ? $currency.' '.$amount : $amount;
}
}