feat: add form-row-wide class support for checkout fields
- Added isFullWidthField helper to check for form-row-wide in class array - Added getFieldWrapperClass helper to return md:col-span-2 for full width - Applied dynamic width to billing_first_name and billing_last_name - PHP can now control field width via class: ['form-row-wide'] - Added debug logging for shipping to help diagnose shipping not applied issue
This commit is contained in:
@@ -414,6 +414,11 @@ class CheckoutController {
|
||||
}
|
||||
|
||||
// Shipping (best‑effort estimate)
|
||||
// DEBUG: Log shipping data for troubleshooting
|
||||
error_log('[WooNooW Shipping Debug] shipping_method: ' . ($payload['shipping_method'] ?? 'null'));
|
||||
error_log('[WooNooW Shipping Debug] shipping_cost: ' . ($payload['shipping_cost'] ?? 'null'));
|
||||
error_log('[WooNooW Shipping Debug] shipping_title: ' . ($payload['shipping_title'] ?? 'null'));
|
||||
|
||||
if (!empty($payload['shipping_method'])) {
|
||||
$rate = $this->find_shipping_rate_for_order($order, $payload['shipping_method']);
|
||||
if ($rate instanceof WC_Shipping_Rate) {
|
||||
@@ -426,6 +431,7 @@ class CheckoutController {
|
||||
'taxes' => $rate->get_taxes(),
|
||||
]);
|
||||
$order->add_item($item);
|
||||
error_log('[WooNooW Shipping Debug] Added shipping via WC rate lookup: ' . $rate->get_cost());
|
||||
} elseif (!empty($payload['shipping_cost']) && $payload['shipping_cost'] > 0) {
|
||||
// Fallback: use shipping_cost directly from frontend
|
||||
// This handles API-based shipping like Rajaongkir where WC zones don't apply
|
||||
@@ -443,6 +449,9 @@ class CheckoutController {
|
||||
'total' => floatval($payload['shipping_cost']),
|
||||
]);
|
||||
$order->add_item($item);
|
||||
error_log('[WooNooW Shipping Debug] Added shipping via frontend fallback: ' . $payload['shipping_cost']);
|
||||
} else {
|
||||
error_log('[WooNooW Shipping Debug] NO shipping added - rate lookup failed and no valid shipping_cost');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user