Support » Plugin: YITH WooCommerce One-Click Checkout » Order should auto-complete if product is free

  • If the product being purchased is free, the order is marked as “pending payment”. To make matters worse, in the My Account > Orders screen there isn’t a “pay” button, so the customer can’t even complete the order themselves.

    This is really non-sensical, especially from the customer’s point of view. The order should auto-complete if the product is free.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi,
    you are right! Anyway I think that the correct could be also “processing” if the product needs shipping. The developers are solving this an update will be released within next days.
    Anyway if you don’t want to wait for the update, you can use this filter woocommerce_default_order_status for change this behaviour.
    Just add something like this on your functions.php

    add_action( 'yith_wooc_handler_before_redirect', 'custom_filter_order_status', 10, 1 );
    function custom_filter_order_status( $order ) {
    	if( ! $order->needs_payment() ) {
    		$order->update_status( 'completed' );
    	}
    }

    Let me know, regards. 🙂

    Yes, you’re right – it should be “processing” if it’s a shipped product.

    In my current implementation I’m dealing entirely with downloadable virtual products, so I think that the correct status in that case should be “completed”.

    Thanks for the snippet.

    Peter

    Hmm… I just tried your snippet and, although it does work, when the page refreshes WooCommerce puts up notice which says “Thank you. Your order has been received and it is now waiting for payment”!

    Do you know how to stop that, or trigger the custom filter in your snippet earlier so that WC sees the order as completed?

    Cheers

    Plugin Author YITHEMES

    (@yithemes)

    HI,
    you can use this filter yith_wocc_success_msg_order_created for change the notice text. So something like

    add_filter( 'yith_wocc_success_msg_order_created', 'my_custom_notice', 10, 1 );
    function my_custom_notice( $message ) {
    return 'Thank you. Your order has been received!';
    }

    Just change the text as you wish.
    Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Order should auto-complete if product is free’ is closed to new replies.