fix: resolve container width issues, spa redirects, and appearance settings overwrite. feat: enhance order/sub details and newsletter layout
This commit is contained in:
@@ -471,6 +471,31 @@ class SubscriptionsController
|
||||
}
|
||||
$enriched['billing_schedule'] = sprintf(__('Every %s%s', 'woonoow'), $interval, $period);
|
||||
|
||||
// Add payment method title
|
||||
$payment_title = $subscription->payment_method; // Default to ID
|
||||
|
||||
// 1. Try from payment_meta (stored snapshot)
|
||||
if (!empty($subscription->payment_meta)) {
|
||||
$meta = json_decode($subscription->payment_meta, true);
|
||||
if (isset($meta['method_title']) && !empty($meta['method_title'])) {
|
||||
$payment_title = $meta['method_title'];
|
||||
}
|
||||
}
|
||||
|
||||
// 2. If it looks like an ID (no spaces, lowercase), try to get fresh title from gateway
|
||||
if ($payment_title === $subscription->payment_method && function_exists('WC')) {
|
||||
$gateways_handler = WC()->payment_gateways();
|
||||
if ($gateways_handler) {
|
||||
$gateways = $gateways_handler->payment_gateways();
|
||||
if (isset($gateways[$subscription->payment_method])) {
|
||||
$gw = $gateways[$subscription->payment_method];
|
||||
$payment_title = $gw->get_title() ?: $gw->method_title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$enriched['payment_method_title'] = $payment_title;
|
||||
|
||||
return $enriched;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user