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:
@@ -64,9 +64,24 @@ class WooProduct extends Model
|
||||
return '—';
|
||||
}
|
||||
|
||||
$currency = strtoupper((string) ($this->store?->metadata['currency'] ?? 'GHS'));
|
||||
if ($this->relationLoaded('store') || $this->store) {
|
||||
return $this->store->formatMoney($minor);
|
||||
}
|
||||
|
||||
return $currency.' '.number_format($minor / 100, 2);
|
||||
return number_format($minor / 100, 2);
|
||||
}
|
||||
|
||||
public function regularPriceFormatted(): string
|
||||
{
|
||||
if ($this->regular_price_minor === null) {
|
||||
return '—';
|
||||
}
|
||||
|
||||
if ($this->relationLoaded('store') || $this->store) {
|
||||
return $this->store->formatMoney((int) $this->regular_price_minor);
|
||||
}
|
||||
|
||||
return number_format(((int) $this->regular_price_minor) / 100, 2);
|
||||
}
|
||||
|
||||
public function statusLabel(): string
|
||||
|
||||
Reference in New Issue
Block a user