• Resolved sk3eter

    (@sk3eter)


    Dear all,

    i really love the plugin and want to purchase the pro version. But unfortunately there is a compatibility problem with klarna payment. Whenever i want to redeem a gift card on cart, process through payment and choice klarna it’s causing an error which says: Klarna-Invoice Payment can’t be created. With any other payment method it’s working so far, but lots of our customers from germany prefer Klarna as main Gateway.

    Below please find a screenshot:
    https://ibb.co/XzDL1tS

    We are using mollie integration for WooCommerce as multi-gateway payment proccessor.

    Hope you can help us here, fixing this problem.

    Kind regards,
    Daniel

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author pimwick

    (@pimwick)

    Sorry to hear about the conflict, we had another user report a similar issue and we’re looking into making the gift cards plugin compatible with Klarna checkout. Once we have a fix I will update this thread.

    Same issue here
    @pimwick Do you maybe have an orientation time when the update fix will be available?

    Thread Starter sk3eter

    (@sk3eter)

    It would be great if we can exclude Klarna as payment gate as long as gift card is applied to cart to use it as a temporary solution.

    I tried this Snippet, but this seems to NOT to the trick here in my case:

    add_filter(‘woocommerce_available_payment_gateways’, ‘unset_gateway_by_applied_coupons’);

    function unset_gateway_by_applied_coupons($available_gateways)
    {

    $coupons = WC()->cart->applied_coupons;

    if (!empty($coupons)) {
    unset($available_gateways[‘klarnapaylater’]);
    }

    return $available_gateways;
    }

    Can you help here?

    Kind regards,
    Daniel

    • This reply was modified 4 years, 4 months ago by sk3eter.
    • This reply was modified 4 years, 4 months ago by sk3eter.
    Plugin Author pimwick

    (@pimwick)

    To prevent certain payment methods from being allowed when a gift card is applied, follow these steps:

    1. Download the free Code Snippets plugin: https://www.ads-software.com/plugins/code-snippets/
    2. Create a Snippet with the following code:

    function pw_gift_card_payment_methods( $available_gateways ) {
        $redeeming_gift_card = false;
    
        if ( defined( 'PWGC_SESSION_KEY' ) ) {
            $session_data = (array) WC()->session->get( PWGC_SESSION_KEY );
            if ( isset( $session_data['gift_cards'] ) && count( $session_data['gift_cards'] ) > 0 ) {
                $redeeming_gift_card = true;
            }
    
            if ( $redeeming_gift_card === true ) {
                // Klarna Checkout
                unset( $available_gateways['klarna'] );
            }
        }
    
        return $available_gateways;
    }
    add_filter( 'woocommerce_available_payment_gateways', 'pw_gift_card_payment_methods' );

    If you are more comfortable editing your functions.php file that works, too.

    The key used in the $available_gateways array can be found by going to WooCommerce -> Settings -> Payments -> Look for the “section=” in the URL for the payment method.

    Thread Starter sk3eter

    (@sk3eter)

    Hi there,

    that Snippet worked like a charm but for only one week.
    Now it’s causing a critical system error and the gateways are still showing up in the checkout. I’ve checked if there were any changes in the gateway names, but there aren’t.

    Can you please double check what happened here? Any Update maybe?

    Kind regards,
    Daniel

    Plugin Author pimwick

    (@pimwick)

    We need to see the log file regarding the critical system errors. Perhaps there is a typo or something introduced to the code.

    Could you perform the following steps please:

    1. Log into your FTP site and edit wp-config.php
    2. Set the following values (add the lines if they don’t exist):

        define( 'WP_DEBUG', true );
        define( 'WP_DEBUG_LOG', true );
        define( 'WP_DEBUG_DISPLAY', false );
        @ini_set( 'display_errors', 0 );

    3. Return to the site and trigger the error again.
    4. Now go back to FTP and send me the file /wp-content/debug.log
    5. Return to wp-config.php and set DEBUG back to false (reverting the changes made in Step 2)

    If you aren’t comfortable with performing the steps above, contact your website host and they should be able to assist you in locating this log file.

    Thread Starter sk3eter

    (@sk3eter)

    Well somehow it’s not causing this error anymore,

    but i still got a problem with the gateways.
    If i follow your description and find out the arrays in URL, then my code looks something like this:

    function pw_gift_card_payment_methods( $available_gateways ) {
        $redeeming_gift_card = false;
    
        if ( defined( 'PWGC_SESSION_KEY' ) ) {
            $session_data = (array) WC()->session->get( PWGC_SESSION_KEY );
            if ( isset( $session_data['gift_cards'] ) && count( $session_data['gift_cards'] ) > 0 ) {
                $redeeming_gift_card = true;
            }
    
            if ( $redeeming_gift_card === true ) {
                // Klarna Checkout
    			unset( $available_gateways['mollie_wc_gateway_klarnapaylater'] );
    			unset( $available_gateways['mollie_wc_gateway_klarnasliceit'] );
            }
        }
    
        return $available_gateways;
    }

    However it’s not unsetting both variations of Klarna Payment (Invoice [Paylater] and Installments [Slice It]. Only one of them if I try to unset both.

    Am I doing something wrong here?

    We are using Mollie as multiple Gateway Provider.

    Hope you can help me out here.

    Kind regards,
    Daniel

    Plugin Author pimwick

    (@pimwick)

    Hi Daniel, you will need to reach out to the Mollie developers for help with this. I’m assuming that they are not using the standard WooCommerce hook since they are combining gateways. They should be able to provide you with code to disable gateways under certain conditions.

    Plugin Author pimwick

    (@pimwick)

    I’m marking this thread as resolved but let us know if you have any further questions.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Issue with Klarna Payment (Invoice)’ is closed to new replies.