Show product item cost including tax
add_filter(
'woocommerce_order_amount_item_subtotal',
function( $subtotal, $order, $item, $inc_tax, $round ) {
if ( ! empty( $item ) ) {
$subtotal = ( (float) $item->get_subtotal() + (float) $item->get_subtotal_tax() ) / $item->get_quantity();
$subtotal = $round ? \Automattic\WooCommerce\Utilities\NumberUtil::round( $subtotal, wc_get_price_decimals() ) : $subtotal;
return $subtotal;
}
return $subtotal;
},
10,
5
);

Last updated
Was this helpful?