• Resolved Sam Pryor

    (@sampryor)


    I have set in Tax Options: ‘Yes, I will enter prices inclusive of tax’;

    I’m adding an array of order fee items to an order with:

                    
    $item = new WC_Order_Item_Fee();
    $item->set_name( $fee_item['name'] );
    $item->set_total( $fee_item['total'] );
    $tax_class = (isset($fee_item['tax_class']) && $fee_item['tax_class'] !== 0) ? $fee_item['tax_class'] : 0;
    $item->set_tax_class( $tax_class ); // O if not taxable
    $item->calculate_taxes($calculate_taxes_for);
    $item->save();
    $order->add_item( $item );
    

    But these fee items are calculated wrong, tax is being added.
    With 10% Tax set
    A $9 item becomes $9.00 with $0.90 TAX
    When it should be $8.18 with $0.82 TAX

    I have to hard code my controller to set the price correctly, but it should really calculate correctly based off the tax classes.

    • This topic was modified 3 years, 8 months ago by Sam Pryor.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Order Item Fees not calculating inclusive tax correctly’ is closed to new replies.