is_wallet_rechargeable_cart return FALSE even if balance and cart total equal2020-08-05T13:26:28+05:30

Home Forums Core is_wallet_rechargeable_cart return FALSE even if balance and cart total equal

Viewing 1 post (of 1 total)
  • Author
    Posts
  • masi.raphael
    Participant
    Post count: 2

    Hi,

    I found a random BUG that came from PHP. In function is_full_payment_through_wallet() you make comparison between a float (cart total) and a string (wallet balance) without formatting them. In some case, the same value in both of them don’t give true on ($current_wallet_balance >= $total) comparison, but something like -1.7763568394003E-15 for example.

    I suggest this in your next update :

    number_format ((float)woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), ‘edit’ ), 2);
    in replacement of :
    woo_wallet()->wallet->get_wallet_balance( get_current_user_id(), ‘edit’ ); // Line 253

    $total = number_format ((float) $order->get_total(), 2);
    in replacement of:
    $total = (float) $order->get_total(); // Line 262

    $total = number_format ((float) get_woowallet_cart_total(), 2);
    in replacement of:
    $total = (float) get_woowallet_cart_total(); // Line 266

    For the moment, I use your filter is_valid_payment_through_wallet to make this correction.

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