• Resolved pandabrand

    (@pandabrand)


    I am working on a React app for a customer, and I am tying to set up order processing. I can create an order and update it, but I can’t figure out how to get taxes calculated. I am looking for the API equivalent of the ‘Recalculate’ button when manually creating orders in the Admin dashboard.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    At the moment there is no API equivalent of the “recalculate” button for taxes in the REST API. The closest to that would be to fetch the tax rates configured and then manually recalculate the taxes using your own app logic based on the shop, billing or shipping address of the order to which it will be applied.

    Thread Starter pandabrand

    (@pandabrand)

    Ok, got this working adding to this because I had hard time finding this. We’re also using the Avalara tax plugin for this, so I needed to use that for tax calculations. This is what I used:

    
    $order = wc_get_order($order_id);
    wc_avatax()->get_order_handler()->calculate_order_tax( $order );
    $order->calculate_totals(false);
    $order->save();
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Calcukate tax via API’ is closed to new replies.