While testing compatibility with PHP 8 I noticed that direct access to WC_Order_Item_Coupon is now deprecated, which results in deprecation warnings being logged:
[19-Nov-2020 16:28:26 UTC] The WC_Order_Item_Coupon::offsetGet function is deprecated since version 4.4.0.
I wanted to remove those warnings but then I realized this code doesn't seem to be doing much right now as "line_total" is not even set for coupon order items (i.e. it is null). As this doesn't seem to have an impact (and discounts/totals look fine on PayPal's side) It'd be good to confirm whether we even need this code anymore.
In #677, we introduced the following code as part of changes dealing with amount mismatch and discounts (see #485 for details):
https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/blob/ed4161e96d7c139b1b331c4123f269c766acb1e8/includes/class-wc-gateway-ppec-client.php#L868-L872
While testing compatibility with PHP 8 I noticed that direct access to
WC_Order_Item_Coupon
is now deprecated, which results in deprecation warnings being logged:I wanted to remove those warnings but then I realized this code doesn't seem to be doing much right now as "line_total" is not even set for coupon order items (i.e. it is
null
). As this doesn't seem to have an impact (and discounts/totals look fine on PayPal's side) It'd be good to confirm whether we even need this code anymore.