Support » Plugin: Pay for Payment for WooCommerce » Error on PHP8 -> Unsupported operand types: string + float

  • Resolved Javier

    (@xarkitu)


    Hi,

    I am encountering a recurring error in your plugin that is causing you to lose sales by generating this error in the cart:

    PHP Fatal error: Uncaught TypeError: Unsupported operand types: string + float in /wp-content/plugins/woocommerce-pay-for-payment/inc/class-pay4pay.php:173

    I have been able to fix it by forcing the values ​​to both be of type float as I show here:

    if ( $include_coupons ) {
    							if ( version_compare( WC_VERSION, '3.2', '>' )) {
    								$calculation_base -= (float)$cart->get_total_discount() + (float)$cart->discount_cart;
    							} else {
    								$calculation_base -= $cart->discount_total + $cart->discount_cart;
    							}
    						}

    I would be grateful if you looked at this, this failure can lead to lost sales due to the customer finding an error and not being able to complete their purchase.

    Best regards

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.