Last active
May 11, 2018 11:24
-
-
Save NiklasHogefjord/762ddccf64e52d795fb83fe4adff5321 to your computer and use it in GitHub Desktop.
Display a checkbox in KCO that is required to check to be able to complete purchase. This is used for the WooCommerce Klarna gateway (v2).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add a cehckbox to KCO iframe that is required to check before the purchase can be completed | |
add_filter('kco_create_order', 'krokedil_add_required_checkbox'); | |
add_filter('kco_update_order', 'krokedil_add_required_checkbox'); | |
function krokedil_add_required_checkbox( $create ) { | |
$create['options']['additional_checkbox']['text'] = 'I agree to the <a href="https://example.com/terms" target="_blank">terms</a> and data policy.'; | |
$create['options']['additional_checkbox']['checked'] = false; | |
$create['options']['additional_checkbox']['required'] = true; | |
return $create; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment