• Noticed this warning while debugging PDF invoices

    To reproduce:

    • Activate both plugin(s)
    • Don’t configure/activate Adyen integration
    • Generate PDF invoice
    • Add debug parameter to URL &output=html&debug=true
    Warning: Undefined variable $method_type in integration-adyen-woocommerce/includes/payment-methods/class-googlepay.php on line 118
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter areklam

    (@areklam)

    This breaks the WooCommerce settings pages, not just by using a separate plugin.

    In “class_googlepay.php” the function payment_method_type() have to change the empty check, since $method_type can be empty.

    On line 117 I added && !empty( $method_type )

    if ( empty( $google_method ) && !empty( $method_type ) ) {
             set_transient( PREFIX . '_google_method', $method_type, \HOUR_IN_SECONDS );
             $google_method = 'googlepay';
          }

    @areklam this error only happens if you haven’t authorized API credentials in woosa settings.

    dvdm

    (@dvdm)

    This issue also occurs right after activating the plugin. The $method_type variable depends on this foreach loop:

    foreach(Service::checkout()->get_payment_methods() as $item){
    $method_type = Util::array($item)->get('type');
    // ..
    }

    But if there aren’t any payment methods (yet), this gives an undefined warning:

    set_transient( PREFIX . '_google_method', $method_type, \HOUR_IN_SECONDS );

    • This reply was modified 1 year ago by dvdm. Reason: markup
    • This reply was modified 1 year ago by dvdm. Reason: markup
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Undefined variable $method_type’ is closed to new replies.