Skip to content

Instantly share code, notes, and snippets.

@vanbo
Created December 14, 2021 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanbo/ffda6cc993fcbc8948cd85e8fdb9b4db to your computer and use it in GitHub Desktop.
Save vanbo/ffda6cc993fcbc8948cd85e8fdb9b4db to your computer and use it in GitHub Desktop.
WC Paytrace-strip description tags
/**
* Please add to your "wp-content/themes/theme-name/functions.php" file or anywhere that you know the code will be executed
*/
add_filter( 'wc_paytrace_transaction_request', 'vanbodevelops_paytrace_request_strip_tags', 10, 5 );
/**
* @param array $request_parameters
* @param WC_Order $order The order to be charged
* @param float $amount Amount to be charged
* @param bool $is_subscription Is this a subscription
* @param bool $is_paid_with_profile Is this a profile payment(true) or new card is used(false)
*
* @return array
*/
function vanbodevelops_paytrace_request_strip_tags( $request_parameters, $order, $amount, $is_subscription, $is_paid_with_profile ) {
// Add the field to the request
if ( isset($request_parameters['description']) ) {
$request_parameters['description'] = strip_tags($request_parameters['description']);
}
return $request_parameters;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment