Skip to content

Instantly share code, notes, and snippets.

@justinstern
Created November 12, 2013 22:39
Show Gist options
  • Save justinstern/7440122 to your computer and use it in GitHub Desktop.
Save justinstern/7440122 to your computer and use it in GitHub Desktop.
Sample code for adding a custom parameter to the WooCommerce Elavon VM Payment Gateway transaction request. This is most useful when a custom field is required on an account. Simply add the following to the bottom of your theme's functions.php, including whatever custom parameters your account setup requires
<?php
add_filter( 'wc_payment_gateway_elavon_vm_request_xml', 'wc_payment_gateway_elavon_vm_add_custom_fields', 10, 2 );
function wc_payment_gateway_elavon_vm_add_custom_fields( $request_xml, $request ) {
$request_xml->addChild( 'ssl_name_on_card', str_replace( array( '&', '<', '>' ), '', $request->ssl_first_name . ' ' . $request->ssl_last_name ) );
return $request_xml;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment