• Hi.

    I’m using a function to autocomplete orders once a user hits the thank you page for an order i.e. when they’re redirected back from PayPal having made a payment.

    add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
    function custom_woocommerce_auto_complete_order( $order_id ) {
        global $woocommerce;
    
        if ( !$order_id )
            return;
        $order = new WC_Order( $order_id );
        $order->update_status( 'completed' );
    }

    This works great for individual products. However, when a user buys a bundle, only the first product in the bundle shows up for them as being purchased. Any ideas why this might be?

    Thanks!

    https://www.ads-software.com/plugins/yith-woocommerce-product-bundles/

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

    (@yithemes)

    Hi,
    Please, could you give us more information?

    when a user buys a bundle, only the first product in the bundle shows up for them as being purchased

    Where does the first product in the bundle show up for them as being purchased?
    Could you provide us some screenshot, please?

    Best Regards

    Thread Starter l0tech

    (@l0tech)

    Thanks for the reply.

    Sorry, a little more information would be helpful I’m sure.

    We’re running a system that offers Courses (a custom post type) to be unlocked when an associated WooCommerce product is purchased i.e. there’s a product for Course 1 and a corresponding Course post titled Course 1. The system uses the SKU number of the product to to unlock the Course on purchase.

    As the products are marked as virtual but not downloadable, the orders get marked as processing after a product is purchased and an admin has to manually complete the transaction. However, we want customers to be able to immediately start the course which is where the code in the OP fits in. As mentioned, the system works fine for single purchases and customers see the course show up in their course list right away on payment confirmation. However, when a bundle is purchased, only the first product in the bundle shows up in their purchased course list. Everything works fine when the purchase is approved manually, so the code above clearly isn’t working well with the bundles plugin.

    For reference, the plugin we’re using to handle the course and purchase logic is https://lifterlms.com. I’m also going to contact their support for ideas as I couldn’t narrow down which side is creating the problem.

    Thanks for the support.

    Plugin Author YITHEMES

    (@yithemes)

    Hi,
    the bundled products are included in an order in the same way of simple products. Therefore there is probably some issues in the plugin that you’re using to handle the course and purchase logic.
    Please, try to contact lifterlms support and let us know.

    Best Regards
    YIThemes

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Difficulty with auto completion of orders’ is closed to new replies.