Hi @dav74,
This is a bug in one of your snippets, not in the core plugin. It’s not something we can fix on our end.
You should be able to narrow down which snippet it is by doing a search for total @line:5. Feel free to post the code here if you’d like help fixing the problem.
Thread Starter
dav74
(@dav74)
Hi @bungeshea
many thanks for your reply! Ok that’s interesting. Apologies for jumping to conclusions. Can you tell me how I start narrowing down which snippet it is, if I have like 30 snippets? Are you saying that the snippet in question has “total @ line:5” in it?
Thread Starter
dav74
(@dav74)
Hi @bungeshea
OK I have looked at all of the 23 published snippets we have but none of them contain total @line:5 I am not sure what exactly I am suppose to be looking for. Can you please advise here so I can find out which snippet is causing the issue?
@dav74 the snippet itself won’t contain total @line:5 – that’s just a search term you can put in the search box on the Snippets menu to narrow down the list.
If you’re searching through manually, you should look for a snippet that contains the term total on line 5 of the code.
Thread Starter
dav74
(@dav74)
Ah! OK we’re learning with you help 🙂 That is perfect. I straight away narrowed it down to 2 snippets, and only one of them was published. Bingo.
Awesome, feel free to post the code here and I’ll do what I can to fix it up.
Thread Starter
dav74
(@dav74)
Well if you feel like looking that would be great. Snippet below.
add_filter( 'woocommerce_available_payment_gateways', 'disable_klarna_above_250' );
function disable_klarna_above_250( $available_gateways ) {
$maximum = 250;
if ( WC()->cart->total > $maximum ) {
unset( $available_gateways['klarna_payments'] );
}
return $available_gateways;
}
You should be able to fix this by adding an isset check:
add_filter(
'woocommerce_available_payment_gateways',
function ( $available_gateways ) {
$maximum = 250;
if ( isset( WC()->cart->total ) && WC()->cart->total > $maximum ) {
unset( $available_gateways['klarna_payments'] );
}
return $available_gateways;
}
);
Thread Starter
dav74
(@dav74)
Great will give that a go!