Here’s the solution to this thread.
// Translate Subtotal to Subtotal (excl. GST)
function wc_translate_subtotal_excl_gst( $translated ) {
if ( get_option( 'woocommerce_prices_include_tax' ) === 'yes' ) {
$text = array(
'Subtotal:' => 'Subtotal (excl. GST):',
'Subtotal' => 'Subtotal (excl. GST)',
'小计:' => '小计(不含GST):',
'小计' => '小计(不含GST)',
);
$translated = str_ireplace( array_keys($text), $text, $translated );
}
return $translated;
}
add_filter( 'gettext', 'wc_translate_subtotal_excl_gst', 20, 3 );
The following filters were added to work alongside the above.
// Shopping Cart Product Price incl. Tax
function wc_cart_product_price( $product_price, $_product ) {
$incl_tax = $_product->get_price_including_tax();
return wc_price( $incl_tax );
}
add_filter( 'woocommerce_cart_product_price', 'wc_cart_product_price', 15, 2 );
// Shopping Cart Product Subtotal excl. Tax
function wc_cart_product_subtotal( $product_subtotal, $_product, $quantity, $object ) {
$row_price = $_product->get_price_including_tax( $quantity );
$incl_tax = wc_price( $row_price );
if ( ! $object->prices_include_tax && $object->tax_total > 0 ) {
$incl_tax .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
}
return $incl_tax;
}
add_filter( 'woocommerce_cart_product_subtotal', 'wc_cart_product_subtotal', 15, 4 );