• Resolved egusplosion

    (@egusplosion)


    Hello,
    I would like to execute the following code only when the product is a virtual and downloadable, could you please tell me how to do that?

    add_action('woocommerce_order_status_changed', 'auto_update_processing_to_complete');
    
    function auto_update_processing_to_complete($order_id)
    {
        if ( ! $order_id ) {
            return;
        }
    
        $order = wc_get_order( $order_id );
        if ($order->data['status'] == 'processing') {
            $order->update_status( 'completed' );
        }   
    }
    
    • This topic was modified 2 years, 1 month ago by egusplosion.
Viewing 1 replies (of 1 total)
  • Hi @egusplosion

    Thanks for reaching out!

    I understand that you want to execute the following code above when a product is virtual and downloadable.

    Kindly be informed that custom coding is outside our scope of support, hence, I am leaving this thread open for a bit to see if anyone can chime in to help you out.

    Meanwhile, can you please share with us your site goals or what are you trying to achieve on your site so that we could address you more effectively?

    If a screenshot would be helpful, I’d recommend using https://snipboard.io or https://skitch.com/. You can share the direct link to the image as a response to this topic.

Viewing 1 replies (of 1 total)
  • The topic ‘I want to execute the following code only when product is virtual and downloadbl’ is closed to new replies.