Skip to content

Instantly share code, notes, and snippets.

@NiklasHogefjord
Created April 29, 2015 09:04
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 NiklasHogefjord/582213ad736aac46681f to your computer and use it in GitHub Desktop.
Save NiklasHogefjord/582213ad736aac46681f to your computer and use it in GitHub Desktop.
Klarna for WooCommerce - filter the phone number returned from Klarna (KCO)
/**
* WooCommerce - Klarna payment gateway
* Filter the phone number returned from Klarna when customer pays via Klarna Checkout.
* Useful when you want to add the country prefix to the phone number.
*
**/
add_filter('klarna_checkout_billing_phone', 'my_custom_klarna_checkout_billing_phone');
function my_custom_klarna_checkout_billing_phone( $phone_number ) {
$country_code = '+47';
$new_phone_number = $country_code . $phone_number;
return $new_phone_number;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment