• Resolved dominic_ks

    (@dominic_ks)


    Hi,

    First off, excellent plugin, have spent days trying all of the credit plugins out there, wish I’d found this one first…

    I’ve come across one issue that I can’t seem to resolve though, steps to create the scenario are:

    – Customer adds product to cart and checks out using Cash On Delivery payment gateway, the Woocommerce order is set to processing
    – Subsequently the customer needs to pay for the order with credits added to the account, order is manually set back to Pending Payment
    – Customer goes via My Account to pay for the order and pays for the order using their credit balance / wallett
    – Order is updated to completed, however the user’s balance is not reduced.

    I tried looking through the process_payment() method in the WC_Gateway_WPUW class but couldn’t see anything that I thought would prevent this from taking place.

    Any ideas?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter dominic_ks

    (@dominic_ks)

    Just to add, I’ve even noted in this scenario that the order is updated with the note “Payment marked completed using Virtual Wallet Order status changed from Pending payment to Completed.”, presumably added from line 262 in gateway.php, so a bit stumped as to how it’s managing to bypass 251/252?

    Plugin Author Justin Greer

    (@justingreerbbi)

    Thanks for reporting this. I am going to attempt to replicate the issue. The only thing off the top of my head would be the user_id is not being brought in for some reason.

    I will update this shortly when/if I figure it out.

    Thanks again.

    Plugin Author Justin Greer

    (@justingreerbbi)

    You mentioned

    Customer goes via My Account to pay for the order and pays for the order using their credit balance / wallett
    – Order is updated to completed, however the user’s balance is not reduced.

    How are they paying for something using their wallet that is set for COD? Are you using a plugin to extend functionality?

    Thread Starter dominic_ks

    (@dominic_ks)

    Hey, thanks for getting back to me, I’ve just added a small function that sets the order status back to Pending Payment (goes to processing by default) but changing the status manually in Woocommerce > Orders has the same effect.

    Ta,

    Plugin Author Justin Greer

    (@justingreerbbi)

    You said

    Customer adds product to cart and checks out using Cash On Delivery payment gateway, the Woocommerce order is set to processing

    Do you mean that they are using their wallet at checkout?

    What I am trying to figure out is how is the user going to their account to pay for a COD order? There is no option to pay for a COD order in the order history.

    Thread Starter dominic_ks

    (@dominic_ks)

    Yes so that’s what I mean:

    • Customer checks out with cod
    • Order is automatically set to processing and customer cannot pay
    • Order is manually set back to pending payment in /wp-admin OR in my case, a php function kicks in on the woocommerce_thankyou_cod hook and updates the order to pending like this – $order->update_status( ‘pending’ );
    • Customer is now able to pay via My Account

    Make sense?

    • This reply was modified 6 years, 10 months ago by dominic_ks.
    Plugin Author Justin Greer

    (@justingreerbbi)

    Yes sir. Thanks for the clarification. I have been able to replicate the issue as well. This is good and bad ;). I am looking into the issue and will update this thread when I find something.

    Plugin Author Justin Greer

    (@justingreerbbi)

    Ok… After finding he issue, I am facepalming myself for not seeing it right away.

    The issue is becuase when a user is paying for something that is “payment pending”, the item(s) are not in the user’s cart. The code is checking for the user
    s cart and not the order ID.

    I will be releasing an update here shortly but if you want to test out the fix:

    Change around line ~237 from
    $cart_total = floatval( WC()->cart->total );
    with
    $cart_total = floatval( $order->get_total() );

    Thread Starter dominic_ks

    (@dominic_ks)

    Well, don’t facepalm yourself too hard, when I was testing a workaround for this earlier, unsure how long you might take to respond here initially, I took a few lines of code from your plugin and put them elsewhere attached the order complete hook. It didn’t work initially, and I realised I needed to change the cart total to order total… Never occurred to me that the same change would fix the overall issue… Doh!

    Thanks very much though, appreciate the help and support, again, great plugin.

    Are you open to contributors on this? Aye you planning to open source it? If yes I could be interested in contributing since this covers my initial requirements very well but we want to do loads more with credits later on.

    Plugin Author Justin Greer

    (@justingreerbbi)

    I am open to contributors for the free version. We can discuss details elsewhere but I too have some more plans as well! You will be hearing from me shortly ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Credit Not Reduced When Paying For Processing Order’ is closed to new replies.