Support » Plugin: Autoptimize » Doesn’t work with Klarna Checkout [SOLVED]

  • Autoptimize affects shopping cart refresh after checkout when used with the Klarna Checkout plugin.

    Removing Autoptimize fixes the problem and allows cart to be emptied after checkout.

    • This topic was modified 5 years, 2 months ago by jumper.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Frank Goossens

    (@futtta)

    Well, if you ever want to revisit; this is fixable in multiple ways actually @jumper 🙂

    frank

    Thread Starter jumper

    (@jumper)

    Really?? That’s great! How do I do that?

    Thanks!

    Plugin Author Frank Goossens

    (@futtta)

    well, one possiblity: if I’m not mistaking “Klarna Checkout” hooks into WooCommerce, in which case you could untick the option “also aggregate your cart/ checkout” in AO’s advanced options.

    alternatively you could use a code like this one to exclude AO on one (or more) specific URL’s (in below example the klarna checkout is on URL /klarna/checkout);

    add_filter('autoptimize_filter_noptimize','klarna_noptimize',10,0);
    function klarna_noptimize() {
    	if (strpos($_SERVER['REQUEST_URI'],'klarna/checkout')!==false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    there are probably other solutions (e.g. excluding the klarna JS from AO JS optimization) but I would need to see the checkout for that.

    let me know if this helps 🙂

    frank

    Plugin Author Frank Goossens

    (@futtta)

    have you been able to look into the above @jumper? 🙂

    Thread Starter jumper

    (@jumper)

    Yes. I had to use both: 1) untick the “aggregate cart” option in Advanced settings, and 2) Paste the filter code you sent in my child theme’s functions.php to solve this problem.

    Thank you!

    Plugin Author Frank Goossens

    (@futtta)

    you’re welcome @jumper, thank you for the updated review score 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Doesn’t work with Klarna Checkout [SOLVED]’ is closed to new replies.