Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage of "line_total" for coupons in WC_Gateway_PPEC_Client::_get_rounded_total_in_order() seems unnecessary #836

Open
jorgeatorres opened this issue Nov 19, 2020 · 1 comment

Comments

@jorgeatorres
Copy link
Member

In #677, we introduced the following code as part of changes dealing with amount mismatch and discounts (see #485 for details):

if ( 'coupon' === $values['type'] ) {
$amount = round( $values['line_total'], $decimals );
$rounded_total -= $amount;
continue;
}

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.

@BrianHenryIE
Copy link

FYI, we're getting those deprecation warnings on PHP 7.3.24 with WP_DEBUG enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants