How to change $purchase_data[‘gateway’] value for straight to gateway?
-
We created a custom Payment Gateway fro EDD, and it is work good.
But in “Buynow” payment, we have a problem.
The problem is that, in below function in function.php file, the purchase gateway is declared as paypal:
function edd_build_straight_to_gateway_data(...){...}
↓↓↓// Setup purchase information $purchase_data = array( ... 'gateway' => 'paypal', ... );
and in below function in process-purchase.php file, in line 1211 it is don’t allow to redirect to payment, because the value of $purchase_data[‘gateway’] is ‘paypal’…not our payment name…
function edd_process_straight_to_gateway( $data )
when we change value of gateway (‘gateway’ => ‘ourpayment’) in function.php file, problem is solved. But we don’t want change in this file, so we want add everything in our EDD payment plugin.
how can we override or change purchase gateway value to our payment gateway name?For example we added below code to our EDD payment plugin, but it is doesn’t work and $purchase_data[‘gateway’] is still ‘paypal’:
add_filter( 'edd_build_straight_to_gateway_data', array( $this, 'edd_build_straight_to_gateway_data' ) ); public function edd_build_straight_to_gateway_data($purchase_data) { $purchase_data['gateway']='ourpayment'; }
- The topic ‘How to change $purchase_data[‘gateway’] value for straight to gateway?’ is closed to new replies.