1

I'm using WC with it's original membership plugin. I'm selling an online course (which is obviously a virtual product). Following should work: Someone purchases the product, order will be automatically completed, user gets an email with password and order confirmation.

I had following code in my functions.php:

/**
 * Auto Complete all WooCommerce orders.
 */
add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order');
function custom_woocommerce_auto_complete_order( $order_id ) {
    if ( ! $order_id ) {
        return;
    }

    $order = wc_get_order( $order_id );
    $order->update_status( 'completed' );
}

The Problem now is that the order is completed but the users won't receive their login credentials and invoice. How do I handle this - what's wrong?

Zwei Rad
  • 15
  • 2
  • This code perfectly works without membership plugin for virtual products, in case see [this similar code](https://stackoverflow.com/questions/35686707/woocommerce-auto-complete-paid-orders-depending-on-payment-methods), but it should not work better. So the problem remains to the membership plugin regarding this. – LoicTheAztec Sep 11 '17 at 15:00
  • but how can I get it to work? :/ is there any chance? – Zwei Rad Sep 11 '17 at 16:02
  • I don't know with your membership plugin… Normally with your code woocommerce send the customer complete order email notification, but not "login credentials and invoice". You should update your question with more details as for example we don't know which is the membership plugin that you are using. You should have to look in the developer documentation of your plugin too, to see what you can use. May be you should ask the support threads of this plugin too... – LoicTheAztec Sep 11 '17 at 16:41

0 Answers0