Page 1 of 1

Check payment method conditions on cart change

Posted: Fri Jun 23, 2023 8:51 pm
by webit
In my payment method that I'm testing on OC4021 I have a condition to be available only above a certain order total. However when changing the content of a shopping cart to a lower value, the payment method is not reloaded and checked again. In this case the payment module is still available while it should not be. Is there are way to re-check the payment conditions after a cart update?

Re: Check payment method conditions on cart change

Posted: Fri Jun 23, 2023 10:38 pm
by ADD Creative
How are you changing the cart contents? All the add, edit and remove methods in catalog/controller/checkout/cart.php clear the payment methods.

Re: Check payment method conditions on cart change

Posted: Sat Jun 24, 2023 12:59 am
by webit
I remove the item in the checkout from the cart popup, afterwards payment method and shipping method remain unchanged and are not checked for their conditions.

Image

Image

Re: Check payment method conditions on cart change

Posted: Sat Jun 24, 2023 3:47 pm
by ADD Creative
I see what you mean. OpenCart 3.0.x used to redirect to the cart page if anything was removed from the cart at checkout. It seems OpenCart 4.0.2.1 does not. It won't let you checkout afterwards, but it's not very user friendly.

You could check if it's been reported on GitHub.

Re: Check payment method conditions on cart change

Posted: Sat Jun 24, 2023 7:12 pm
by webit
Thanks for your reply, with the previous versions of OC4 I did not experience this problem. Also I am able to proceed with the checkout after the cart change.

Re: Check payment method conditions on cart change

Posted: Sat Jun 24, 2023 9:15 pm
by ADD Creative
If you can checkout, do you have a check for the $this->session->data['payment_method'] in your confirm method?

Such as this one.
https://github.com/opencart/opencart/bl ... hp#L23-L25

Re: Check payment method conditions on cart change

Posted: Tue Jun 27, 2023 4:45 pm
by webit
As I do not use the confirm function in my payment method I am not able to use this check, it would mean that I would have to re-code the entire extension to adapt. For now I regard this a bug in this latest version from OpenCart as also the payment totals are not updated using the default shipping/payment methods when making a cart change.

Image

Image