Skip to content

Instantly share code, notes, and snippets.

@NiklasHogefjord
Last active November 30, 2017 21:57
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/8f1acf79999561b9544c7d559b3e6b82 to your computer and use it in GitHub Desktop.
Save NiklasHogefjord/8f1acf79999561b9544c7d559b3e6b82 to your computer and use it in GitHub Desktop.
<?php
// Display an error notice abouve the KCO checkout if the customer is under 18 years.
add_action('klarna_before_kco_checkout', 'my_klarna_before_kco_checkout' );
function my_klarna_before_kco_checkout() {
if ( isset( $_GET['under_age'] ) ) {
echo '<div class="woocommerce-error">';
_e( 'You need to be over 18 years to make a purchase.', 'woocommerce-gateway-klarna' );
echo '</div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment