Support » Plugin: Direct Checkout for WooCommerce » method_exists() expects parameter 2 to be string

  • Resolved extaizi

    (@extaizi)


    Suddenly this error started to show up in my website:

    Warning: method_exists() expects parameter 2 to be string, object given in /home/gree/public_html/capacita/wp-content/plugins/woocommerce-direct-checkout/includes/view/frontend/general.php on line 75

    Everything is up to date so far.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hello,

    Same issue, but not everything is ok… the theme (Divi) styles are being affected.

    Warning: method_exists() expects parameter 2 to be string, object given in …/wp-content/plugins/woocommerce-direct-checkout/includes/view/frontend/general.php on line 75

    +1 have same error:
    PHP Warning: method_exists() expects parameter 2 to be string, object given in /wp-content/plugins/woocommerce-direct-checkout/includes/view/frontend/general.php on line 75

    • This reply was modified 3 years, 8 months ago by webparaplan.

    I have the same problem and its really affecting my website

    Warning: method_exists() expects parameter 2 to be string, object given in /home/customer/www/website.com/public_html/wp-content/plugins/woocommerce-direct-checkout/includes/view/frontend/general.php on line 75

    • This reply was modified 3 years, 8 months ago by libertyking2.
    • This reply was modified 3 years, 8 months ago by libertyking2.

    Same error, it stops people from adding coupons on the cart page.

    The order of the arguments needs to be swapped. Change /includes/view/frontend/general.php:75 from

    if (method_exists('is_empty', WC()->cart) && WC()->cart->is_empty()) {

    to

    if ( method_exists( WC()->cart, 'is_empty' ) && WC()->cart->is_empty() ) {

    as per https://www.php.net/manual/en/function.method-exists.php

    Hello there, I have just applied the change proposed by @brianhenryie and it worked.

    You need to go to plugins editor, select the direct chekcout plugin and edit the line 75 in the named directory. (/includes/view/frontend/general.php:75) or the one that the warning is telling you to solve.

    Thank you @brianhenryie

    Plugin Author beluserra

    (@beluserra)

    Hi
    sorry for the delay
    could you test version 2.4.2 and confirm if it is solved or not?
    regards

    Hello,

    Yes, it seems fixed.

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘method_exists() expects parameter 2 to be string’ is closed to new replies.