• Resolved peter_l_p

    (@peterlarsenpan)


    The PayPal buttons work on checkout, but not in cart or product pages. I get the following php fatal error:

    PHP Fatal error:  Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, null given in /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/class-purchaseunit.php:320
    Stack trace:
    #0 /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/class-purchaseunit.php(320): round()
    #1 /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/class-purchaseunit.php(267): WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit->ditch_items_when_mismatch()
    #2 /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/class-order.php(222): WooCommerce\PayPalCommerce\ApiClient\Entity\PurchaseUnit->to_array()
    #3 [internal function]: WooCommerce\PayPalCommerce\ApiClient\Entity\Order::WooCommerce\PayPalCommerce\ApiClient\Entity\{closure}()
    #4 /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/class-order.php(224): array_map()
    #5 /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Endpoint/class-createorderendpoint.php(186): WooCommerce\PayPalCommerce\ApiClient\Entity\Order->to_array()
    #6 /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/class-buttonmodule.php(150): WooCommerce\PayPalCommerce\Button\Endpoint\CreateOrderEndpoint->handle_request()
    #7 /wp-includes/class-wp-hook.php(303): WooCommerce\PayPalCommerce\Button\ButtonModule::WooCommerce\PayPalCommerce\Button\{closure}()
    #8 /wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
    #9 /wp-includes/plugin.php(470): WP_Hook->do_action()
    #10 /wp-content/plugins/woocommerce/includes/class-wc-ajax.php(90): do_action()
    #11 /wp-includes/class-wp-hook.php(303): WC_AJAX::do_wc_ajax()
    #12 /wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters()
    #13 /wp-includes/plugin.php(470): WP_Hook->do_action()
    #14 /wp-includes/template-loader.php(13): do_action()
    #15 /wp-blog-header.php(19): require_once('/usr/www/users/...')
    #16 /index.php(17): require('/usr/www/users/...')
    #17 {main}
      thrown in /wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-api-client/src/Entity/class-purchaseunit.php on line 320

    WP 5.8-RC3-51429

    Plugins:
    WC 5.5.0
    No other Plugins

    Themes:
    Twenty Twenty-One: 1.3

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @peterlarsenpan,

    Does the same behavior occur for you in a default setup (Only WooCommerce & PayPal Payments) with the latest stable WordPress 5.7.2?
    Thanks!

    Kind regards,
    Niklas

    Thread Starter peter_l_p

    (@peterlarsenpan)

    Hi Niklas,

    tested with

    WordPress Version 5.7.2
    WooCommerce 5.5.1

    The error still exists.
    The error does not always occur, for example I have an item with quantity 3 in the cart: the error does not occur. If I increase the quantity to 4, the error occurs “Something went wrong. Please try again or choose another payment source.” and in the log I find the already mentioned fatal PHP error.

    Plugin Support Andreas W.

    (@aweissinpsyde)

    Hello @peterlarsenpan

    thank you for your information. Please let us make a few more tests so we can try to reproduce that behavior.

    Thank you
    Regards
    Andreas

    Plugin Support Andreas W.

    (@aweissinpsyde)

    Closed because of inactivity

    Thread Starter peter_l_p

    (@peterlarsenpan)

    > Closed because of inactivity

    You wrote:
    > Please let us make a few more tests so we can try to reproduce that behavior.

    Did you make these tests?
    Do you want me to help you to do these tests?

    Error also occurs with version 1.4.0 of your plugin.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error in cart, product page’ is closed to new replies.