We often face this issue.¬† Sometimes we want to activate specific payment gateways¬† depending on selected shipping method. Here is the code —

 

Line 2 : We are getting the selected shipping method.
Line 4: We are checking whether it is local delivery or not (you can put your own shipping method or some other logic) .
Line 6: Now disabling payment gateways.
So in this way you can hide all the payment gateways which you don’t want to make available for the local delivery (or whatever).

Feel free to ask if you have any doubt.

2 thoughts on “Show/Hide payment gateways according to shipping method”

  1. Hey! I know this is kind of off topic but I was
    wondering if you knew where I could locate a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *