Skip to content

Instantly share code, notes, and snippets.

@NiklasHogefjord
Created October 7, 2015 15:03
Show Gist options
  • Save NiklasHogefjord/1c2fcc9fc681ba1e1a13 to your computer and use it in GitHub Desktop.
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
/**
* 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;
}
@SirRahikkala
Copy link

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

@orjansteffensen
Copy link

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