Debug logger affecting PDP performance
-
Hello,
This is a debug logger that shipped to productionplugins/conditional-extra-fees-for-woocommerce/admin/class-payment-processing-fee.php:59-72:
add_filter( 'woocommerce_available_payment_gateways', [$this, 'log_available_gateways'], -100 );function log_available_gateways( $gateways ) { $logged_gateways = []; foreach ( $gateways as $gateway_id => $gateway ) { $logged_gateways[ $gateway_id ] = $gateway->get_title(); } // Save it for later use (e.g., print_r in debug bar or log) update_option( 'pisol_logged_gateways', $logged_gateways ); return $gateways;}The CEFW author’s own comment confirms it’s purely a debug aid. It does three terrible things on every PDP render:
- Hooks at priority -100 (runs before everything), on every
get_available_payment_gateways()call - Calls
get_title()on every gateway — which triggers Stripe’sfilter_gateway_titlecallback that doeswc_get_order()lookups - Calls
update_option('pisol_logged_gateways', …)— a database UPDATE every time the function runs, on a hot path that fires ~6× per request
Impact estimate
- Eliminates all 90 wc_orders SELECTs per PDP render
- Eliminates 6
update_option()writes per PDP render (~6 INSERT/UPDATE on_options) - The function returns
$gatewaysunchanged, so removal has zero functional impact on CEFW’s actual extra-fees feature
Please can you investigate and remove if not expected?
- Hooks at priority -100 (runs before everything), on every
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.