• Resolved dev

    (@devksec)


    Hello,
    This is a debug logger that shipped to production

    plugins/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:

    1. Hooks at priority -100 (runs before everything), on every get_available_payment_gateways() call
    2. Calls get_title() on every gateway — which triggers Stripe’s filter_gateway_title callback that does wc_get_order() lookups
    3. 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 update_option() writes per PDP render (~6 INSERT/UPDATE on _options)
    • The function returns $gateways unchanged, so removal has zero functional impact on CEFW’s actual extra-fees feature

      Please can you investigate and remove if not expected?
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author jyotsnasingh520

    (@jyotsnasingh520)

    Hi,

    Thank you for raising this concern. This function is not intended for error logging; rather, it utilizes the array that we create within the plugin. We will be modifying the function to ensure it no longer calls the get_title function repeatedly and to prevent unnecessary update_option executions. Additionally, we will implement a check to determine whether any data has actually been modified before proceeding, so that redundant operations are avoided.

    Plugin Author jyotsnasingh520

    (@jyotsnasingh520)

    Hi,

    We have released a new version 1.1.49.46 in this we have optimized this function

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.