Change the suffix price when price is entered excluding tax and displayed in including tax
Modify price suffix behavior for tax-inclusive display with tax-excluded suffix.
add_filter('woo_discount_rules_discounted_suffix_price', function ($price_suffix, $product){
if ( $product->is_taxable() ) {
if(class_exists('WC_Tax')){
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
$base_tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class( 'unfiltered' ) );
$remove_taxes = apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ? WC_Tax::calc_tax( $price_suffix, $base_tax_rates, true ) : WC_Tax::calc_tax( $price_suffix, $tax_rates, true );
$price_suffix = $price_suffix - array_sum( $remove_taxes ); // Unrounded since we're dealing with tax inclusive prices. Matches logic in cart-totals class. @see adjust_non_base_location_price.
}
}
return $price_suffix;
}, 10, 2);