How to update Order Status after user paid

Rate this post

i want to create new order in my custom page (has form).

i use this code :

$order = wc_create_order();
$order->add_product( get_product($id), 1);
$order->set_address( $address, 'billing' );
$order->set_address( $address, 'shipping' );

$newTotal = $order->calculate_totals() + (int)$postprice;


everything is OK .

when i want to send user to payment page , im using this codes and redirect user to /checkout/order-pay page :

$order_id = $order->get_id();
$order_key = $order->get_order_key();

add_post_meta($order_id, '_payment_method', 'Farakav');
add_post_meta($order_id, '_payment_method_title', 'بانک ملت');

now , everything is good too . but

User Pay order amount as successfully but order-status cant change to proccessing.

Can you help me?




$order = wc_get_order($order_id);  

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button