Hi Everyone
I want to hide specific payment method (cash on delivery) if specific shipping method selected before. For example, if I check shipping method A , then in the next step, payment methods I have only one method to check ( other methods disabled or unable to check). I try to edit and add some code to payment_method.php and shipping_method.php file in controller/checkout directory, but so far I havent' find the solution.
I tried to get shipping method name/code and build a conditional statement in payments, but I don't know exactly how to deal with it.
Any other ideas how to solve this issue ?
Best
Bartosz
Restrict Payment Methods can do this. You'd set it up like this:
------------------------------------------------------------------------------
RESTRICTION #1
Name: Enable COD if not Shipping Method A
Payment Methods: COD
Rule: Shipping Method is not Shipping Method A
------------------------------------------------------------------------------
Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.
------------------------------------------------------------------------------
RESTRICTION #1
Name: Enable COD if not Shipping Method A
Payment Methods: COD
Rule: Shipping Method is not Shipping Method A
------------------------------------------------------------------------------
Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.
Inside the checkout process shipping method is selected and stored inside the session.
The respective code is found here:
https://github.com/opencart/opencart/bl ... d.php#L125
Inside the model of the respective payment method you could add the if statement. If the model don't return the $method_data, the payment method is not available for checkout. E.g.
https://github.com/opencart/opencart/bl ... cod.php#L8
Something like this needs to be done:
The respective code is found here:
https://github.com/opencart/opencart/bl ... d.php#L125
Inside the model of the respective payment method you could add the if statement. If the model don't return the $method_data, the payment method is not available for checkout. E.g.
https://github.com/opencart/opencart/bl ... cod.php#L8
Something like this needs to be done:
Code: Select all
if (isset($this->session->data['shipping_method']) && $this->session->data['shipping_method'] == 'something_you_want_to_disallow') {
$status = false;
}
Checkout our extensions, or our open source projects
Check out Shipping based payments OpenCart 2.3/3.0 (FREE MODULE)
https://www.opencart.com/index.php?rout ... n_id=31726
you can set for each shipping method all the specific payment methods
https://www.opencart.com/index.php?rout ... n_id=31726
you can set for each shipping method all the specific payment methods
Who is online
Users browsing this forum: No registered users and 6 guests