Created
May 28, 2025 02:19
-
-
Save shameemreza/7af40935ea0cd3aea964c0f06ac504c6 to your computer and use it in GitHub Desktop.
Debug code for iDEAL refund issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Debug code for iDEAL refund issue | |
* | |
* This file contains diagnostic code to help identify why the iDEAL refund | |
* option is missing in WooCommerce Stripe Gateway. Add this to your theme's | |
* functions.php to see the debugging output in the HTML source. | |
*/ | |
// Debug code to check if iDEAL gateway is properly registered | |
add_action('init', function() { | |
add_action('woocommerce_order_item_add_action_buttons', function($order) { | |
if ($order->get_payment_method() === 'stripe_ideal') { | |
echo '<!-- Payment method: stripe_ideal -->'; | |
// Safely check if gateway exists | |
$gateway = wc_get_payment_gateway_by_order($order); | |
if ($gateway && is_object($gateway)) { | |
echo '<!-- Gateway found: yes -->'; | |
echo '<!-- Gateway class: ' . get_class($gateway) . ' -->'; | |
echo '<!-- Supports refund: ' . ($gateway->supports('refunds') ? 'yes' : 'no') . ' -->'; | |
echo '<!-- Supports: ' . implode(', ', $gateway->supports) . ' -->'; | |
} else { | |
echo '<!-- Gateway found: no -->'; | |
} | |
} | |
}, 999); | |
}); | |
// List all registered payment gateways | |
add_action('init', function() { | |
add_action('wp_footer', function() { | |
if (is_admin() && isset($_GET['post']) && isset($_GET['action']) && $_GET['action'] === 'edit') { | |
global $wc_payment_gateways; | |
echo '<!-- Available payment gateways: -->'; | |
if ($wc_payment_gateways) { | |
foreach ($wc_payment_gateways->payment_gateways() as $id => $gateway) { | |
echo '<!-- Gateway: ' . $id . ' | Class: ' . get_class($gateway) . ' -->'; | |
} | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment