• Resolved adatfalo

    (@adatfalo)


    Hi!

    I have a question about place order and status changing.

    After when I use a gift card and the cart total is: 0. Then I would like the order status will change to order completed, not to processing.

    Can you help me with this?

    Thx

Viewing 1 replies (of 1 total)
  • Thread Starter adatfalo

    (@adatfalo)

    Here is a code what I used (if somebody have the same problem):

    add_action('woocommerce_checkout_order_processed', 'change_status_for_free_orders', 10, 3);
    function change_status_for_free_orders($order_id, $data, $order) {
      $order_total = $order->get_total();
      if($order_total == 0) {
        $order->update_status('completed', 'Free order I closed it immediately');
        $order->save();
      }
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Action after using a gift card (cart total 0)’ is closed to new replies.