Home › Forums › WoodMart support forum › thank you page changes › Reply To: thank you page changes
December 5, 2022 at 9:07 pm
#426442
giannisth
Participant
it appears that apparently on functions.php this causes the issue of breaakdown and of the 3 errors reported above.
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 );
if ( $order && ‘cod’ === $order->get_payment_method() ) {
$order->update_status( ‘completed’ );
}
}
i am struggling to find something like this but with no success.
any idea what to apply in order to accomplish automatic set of order to completed status?
thanks in advance!