• Resolved Sphinxxxx

    (@sphinxxxx)


    Hello!

    We have installed your plugin with “Ask for permission” to add an opt-in checkbox for our users. However, we don’t see that checkbox during checkout.

    I suspect that’s because we use Klarna Checkout (https://woocommerce.com/products/klarna-checkout/) with a custom checkout page. Is there a way to make your plugin work with the Klarna checkout process?

    WordPress 4.9.7, WooCommerce 3.4.3, WooCommerce Klarna Gateway 2.5.3, WooCommerce MailChimp 2.1.12

    Thanks,
    Andreas

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Saint Systems

    (@saintsystems)

    Our plugin hooks into the default WooCommerce checkout and order hooks. However, if the Klarna checkout overrides those hooks, then it won’t trigger our plugin. You would probably have to implement some custom code to integrate specifically with the Klarna checkout and any hooks it exposes to then trigger our plugin functionality.

    Thread Starter Sphinxxxx

    (@sphinxxxx)

    Thanks, and sorry for not reporting back sooner. You are correct, I needed to use a couple of Klarna hooks to make this work. The process is described here (Swedish): https://krokedil.se/lagg-till-en-checkbox-att-prenumerera-pa-nyhetsbrev-klarna-checkout-kassan/

    The code (goes in functions.php):

    add_filter( 'kco_create_order', 'my_add_newsletter_signup' );
    add_filter( 'kco_update_order', 'my_add_newsletter_signup' );
    function my_add_newsletter_signup( $create ) {
        $create['options']['additional_checkbox']['text'] = 'Subscribe to our newsletter';
        $create['options']['additional_checkbox']['checked'] = false;
        $create['options']['additional_checkbox']['required'] = false;
        return $create;
    }
    
    add_action( 'klarna_before_kco_confirmation', 'my_add_kco_order_data', 10, 2 );
    function my_add_kco_order_data($order_id, $klarna_order ) {
        // $klarna_order is the returned object from Klarna
        if( $klarna_order['merchant_requested']['additional_checkbox'] ) {
            update_post_meta( $order_id, 'ss_wc_mailchimp_opt_in', 'yes' );
        }
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Klarna Checkout’ is closed to new replies.