Created
October 7, 2015 15:03
-
-
Save NiklasHogefjord/1c2fcc9fc681ba1e1a13 to your computer and use it in GitHub Desktop.
Klarna for WooCommerce - Filter Create order object sent to Klarna for disabling autofocus of email field
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
/** | |
* WooCommerce - Klarna payment gateway | |
* Filter Create order for disabling autofocus of email field. | |
**/ | |
// New order ($create) | |
add_filter('kco_create_order', 'my_kco_create_order'); | |
function my_kco_create_order( $create ) { | |
$create['gui']['options'] = array('disable_autofocus'); | |
return $create; | |
} |
You need to change line 7
to:
add_action('kco_create_order', 'my_kco_create_order');
With that change, it's working for me on latest version of WooCommerce & the woocommerce-gateway-klarna
plugin.
Sorry, should this work with adding the those lines to functions.php? with the modified line 7 for WooCommerce Klarna Gateway 2.5.11 it still focuses to form.
https://github.com/woocommerce/woocommerce-gateway-klarna
Received this snippet from Krokedil which worked for me
/**
* WooCommerce - Klarna payment gateway
* Filter Create order for disabling autofocus of email field.
**/
// New order ($create)
add_filter('kco_wc_create_order', 'my_kco_create_order');
function my_kco_create_order( $create ) {
$create['gui']['options'] = array('disable_autofocus');
return $create;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you managed to get this working with Klarna Checkout? Doesn't seem to listen to it, especially on mobile, focus kicks in and shoots the page down to the bottom of the site. Missing all the information.