0

On my website with WooCommerce I have prices including taxes but I need single items and totals on new order emails to show the price excluding taxess

I would consider a solution that show the price excluding taxes next to the price including taxes or one that replaces it, I just need to see the prices without taxes for single items and total on new order emails.

I immagine a solution could be a code inside functions.php or editing an email template.

NOTE: Prices are inserted excluding taxes on backend but showed including taxes base on a single tax rate.

I'm not very skilled with code so tried this snippet inside functions.php generated from ChatGPT:

add_filter( 'woocommerce_order_amount_item_total', 'show_price_without_tax_on_email_notification', 10, 5 );
add_filter( 'woocommerce_get_order_item_totals', 'show_total_without_tax_on_email_notification', 10, 3 );

function show_price_without_tax_on_email_notification( $total, $item, $order, $inc_tax = true, $round = true ) {
    $product = $item->get_product();
    $total = ( $product->get_price() * $item->get_quantity() );
    return $total;
}

function show_total_without_tax_on_email_notification( $total_rows, $order, $tax_display ) {
    $total_rows['order_total']['value'] = wc_price( $order->get_subtotal() + $order->get_shipping_total() - $order->get_discount_total() );
    return $total_rows;
}

That showed price excluding taxes only on the total but not on single items table and subtotal.

I searched on other topics around but I only found solutions involving only showing the total excluding taxes instead of the price incl. taxes on a new table row.

Thank you in advance for help.

  • Look there, it will help you https://stackoverflow.com/questions/37227730/display-woocommerce-product-price-with-and-without-tax-and-tax-amount – Pavel8289 May 15 '23 at 20:03

0 Answers0