Skip to content

Instantly share code, notes, and snippets.

@vanbo
Last active February 1, 2021 07:58
Show Gist options
  • Save vanbo/16b154dbfa4ef28333d043e2c6d5c69f to your computer and use it in GitHub Desktop.
Save vanbo/16b154dbfa4ef28333d043e2c6d5c69f to your computer and use it in GitHub Desktop.
WooCommerce TrustCommerce Modify Payment Request
/**
* NOTЕ: Add the code to your "themes\child-theme\functions.php" file
*/
add_filter( 'wc_trustcommerce_process_single_payment_request', 'prefix_modify_payment_request', 10, 3 );
function prefix_modify_payment_request( $request, $order, $gateway ) {
// You have access to all request properties right before a payment request is sent.
// Disable the AVS
if ( isset( $request['avs'] ) ) {
$request['avs'] = 'n';
}
// Remove IP address from the request
if ( isset( $request['ip'] ) ) {
unset( $request['ip'] );
}
// Always return the parameters
return $request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment