Use WooCommerce store currency for product and order money.
Deploy Ladill Woo Manager / deploy (push) Successful in 35s
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user