Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Set status to completed after Charge.succeeded is recieved

$
0
0

Replies: 0

Because i use Woo Subscriptions i would like to skip the on-hold status to set the subscription to active.
So the order then would be in the ‘processing’ status.
Is there a way to automaticly set the order to ‘completed’ if the Webhook Charge.succeeded is recieved?
Is there any action the i could use and is there a variable where i could get the status of the charge?
And would this interfere with the plugin in any way?

Normally i could just skip the processing status but i can’t do that here because of the subscriptions, because i would like to have a status to reflect that the payment is still pending. Otherwise i could just skip to ‘completed’.

Right now im skipping the on-hold status like this:

add_action( 'woocommerce_order_status_changed', 'wc_order_processing_SEPA', 10, 4 );
function wc_order_processing_SEPA( $order_id, $status_from, $status_to, $order ) {
    if($order->get_payment_method() === 'stripe_sepa' && $status_to === 'on-hold') {
        $order->update_status( 'processing' );
    }
}

Viewing all articles
Browse latest Browse all 59525

Trending Articles