[Pro Sites] Restrict payment gateways by payment period

Is it possible to restrict which payment gateways a customer can use based on their payment period? I would like to only allow manual payments for customers who sign up for a whole year.

  • Adam Czajczyk
    • Support Gorilla

    Hi drew_mathers

    I hope you're well today!

    Currently this is not possible out of the box and would require some custom coding. I'm not sure, though, how complex that would be so let me ask our developers if we are able to help you with this.

    I've already forwarded this question to them so they'll look into it and let us know here if it would be doable and if so, how to achieve this.

    Please keep an eye on this ticket for further information but please note also that it might take them a little bit longer to respond than it takes us here on forum as they're dealing with lots of complex issues on daily basis.

    We'll keep you updated.

    Best regards,
    Adam

  • Panos
    • SLS

    Hey drew_mathers !

    This is not available as Adam already mentioned, but you could possibly allow that with some javascript.

    I have a prepared a snippet as an example. That snippet would work if the second gateway is the one you need to be hidden, and it will show it only when the "Annually" period is selected.

    You can download the php file with that snippet from here:
    https://gist.github.com/wpmudev-sls/9e195f8d545bb58bbdcfd9e5a0771a48
    unzip and upload the php file to your wp-contents/mu-plugins folder (you can simply create that folder if it doesn't exist).

    If it doesn't work it will probably need some tweaking as it is specific to the period and the position of the gateway you need hidden in the list. In such case please let us know so we can have another look at it.

    Hope this helps!

    Kind regards!

  • drew_mathers
    • Design Lord, Child of Thor

    HI Panos,

    This seems to work if the Period Selector Position is set for the first column. If it is set for Above the table, then the second gateway will never become available for annual plans.

    I also discovered that it is vitally important to completely clear the browser cache after each test.

    Tested with Twenty Seventeen theme.

  • Adam Czajczyk
    • Support Gorilla

    Hi drew_mathers

    I test code form Panos on my end and you're right, it only works if the period selector is set to be in first column (as this is the default setup, I think).

    I made some small adjustments to the code and according to my tests it now works with both first column and top selector so give it a try please. You'll find updated code here:

    https://gist.github.com/spythemes/ec04ec807c4b97c21c7d0f62e4ff2cd2

    As for cache: yes, this might require clearing cache as it's JS solution so the code might be cached in browser. But once you got a working solution it shouldn't matter for the "end users".

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.