mediagiantdesign Posted November 1, 2022 Share Posted November 1, 2022 Hello, Im implmenting a custom Free Trial payment gateway leveraging the example code for payment gateways from GITHUB. Everything works great, but I need to retrieve settings from the payment gateways settings when the viewcart hook fires. I have the code and logic in place, and a basic conditional working, but for it to work to spec, I need to pull back a custom fields called promocodes from the payment gateways config. How do I do this? //hook to only allow the free trial to show if one of the allowed promo codes have been entered function filter_freetrial_gateway($vars) { logModuleCall("FREETRIAL", "REMOVE FREE", $vars['gateways'], $vars['gateways'], $vars); //retrieve the payment gateways settinsg for freetrial and process into array //check if the promo code exists in the allowed array - to be implemented if (($vars['templatefile']=='viewcart') && ($vars['promotioncode'] != "SEOTRIAL30")){ // List of gateways to remove $disallowed = array('freetrial'); $gateways = $vars['gateways']; foreach ($gateways as $k => $item) { if (in_array($item['sysname'],$disallowed)) { unset($gateways[$k]); } } return array("gateways" => $gateways); } } add_hook("ClientAreaPageCart", 1, "filter_freetrial_gateway"); I borrowed the basis of this code from another post here on the community. Just trying to get the last piece in place. Thanks in advance for the assistance. 0 Quote Link to comment Share on other sites More sharing options...
mediagiantdesign Posted November 8, 2022 Author Share Posted November 8, 2022 Anyone? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.