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:
@@ -9,6 +9,7 @@ class OrderSyncService
|
||||
public function __construct(
|
||||
private PluginClient $client,
|
||||
private OrderIngestService $orders,
|
||||
private CatalogSyncService $catalog,
|
||||
) {}
|
||||
|
||||
public function syncOrders(WooStore $store): int
|
||||
@@ -18,11 +19,19 @@ class OrderSyncService
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isset($response['currency']) || isset($response['currency_symbol'])) {
|
||||
$this->catalog->applyStoreMeta($store, $response);
|
||||
}
|
||||
|
||||
$items = $response['data'] ?? $response;
|
||||
if (! is_array($items)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (array_is_list($items) === false && isset($response['data']) === false) {
|
||||
$items = array_values(array_filter($items, fn ($item) => is_array($item) && (isset($item['id']) || isset($item['number']))));
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
foreach ($items as $item) {
|
||||
if (! is_array($item)) {
|
||||
|
||||
Reference in New Issue
Block a user