Skip to content

Error on PHP8 -> Unsupported operand types: string + float #63

@SUGO-es

Description

@SUGO-es

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions