0

PHP Deprecated: round(): Passing null to parameter #1 ($num) of type int|float is deprecated in "PREPAID_TAXABLE_AMOUNT"=> (($item->getDiscountAmount()) ? abs( round($item->getSubTotal(), 2) - round($item->getDiscountAmount(), 2) ) : '' )

I am getting this error in PHP 8 & Magento2.4

How to solve it?

2 Answers 2

0

This will fix the problem

"PREPAID_TAXABLE_AMOUNT"=> (($item->getDiscountAmount()) 
? abs( round((float) $item->getSubTotal(), 2) - round((float) $item->getDiscountAmount(), 2) ) 
: '' )
0

You can try this to fix the problem

"PREPAID_TAXABLE_AMOUNT"=> (
    ($item->getDiscountAmount() !== null) 
    ? abs(
        (is_numeric($item->getSubTotal()) ? round($item->getSubTotal(), 2) : 0)
        - (is_numeric($item->getDiscountAmount()) ? round($item->getDiscountAmount(), 2) : 0)
    )
    : ''
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.