Woocommerce zero-value orders keeps asking for payment method

[ad_1]

I run a WooCommerce webshop and use the PW WooCommerce Gift Cards plugin. When a client uses a gift card and the total amount of the order is zero, it still asks for a payment method at checkout. I have already disabled all other plugins except PW and WooCommerce, and temporarily switched themes (I use Flatsome). Unfortunately, this did not resolve the issue. I also contacted the plugin owner and WooCommerce support. They confirmed that my WooCommerce settings are correct and that there are no conflicting plugins. The final thing I did was trying custom code for zero-value orders.
I added this PHP code to my theme’s functions.php:

add_action('woocommerce_thankyou', 'auto_complete_zero_value_orders');
function auto_complete_zero_value_orders($order_id) {
    if (!$order_id) return;

    $order = wc_get_order($order_id);
    if ($order->get_total() == 0) {
        $order->update_status('completed');
    }
}

That also had no effect. I hope that someone else can help me further. Thanks in advanced.

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

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer