Commit cd42d58c0ab for woocommerce
commit cd42d58c0ab1a7586be90e96aef457ec30f846d8
Author: Brian <brian@brianhaas.li>
Date: Thu Apr 16 23:30:54 2026 +0200
Add tax label to regular and sales price in admin (#62044)
* add tax label to be more transparent if price has to be set with or without tax
* add tax label also for variable products
* refactor
* align strings to existing usage
* fix string and nested approach
* Add changefile(s) from automation for the following project(s): woocommerce
* fix lint errors
* fix lint error
* Initialize $tax_label to ''
* Initialize $tax_label to ''
---------
Co-authored-by: woocommercebot <woocommercebot@users.noreply.github.com>
diff --git a/plugins/woocommerce/changelog/62044-patch-10 b/plugins/woocommerce/changelog/62044-patch-10
new file mode 100644
index 00000000000..39b33a4b2ab
--- /dev/null
+++ b/plugins/woocommerce/changelog/62044-patch-10
@@ -0,0 +1,4 @@
+Significance: minor
+Type: tweak
+
+Add translatable “(incl. tax)” / “(excl. tax)” labels to product price fields depending on WooCommerce tax settings.
\ No newline at end of file
diff --git a/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-general.php b/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-general.php
index aad59902435..609b4be3530 100644
--- a/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-general.php
+++ b/plugins/woocommerce/includes/admin/meta-boxes/views/html-product-data-general.php
@@ -49,11 +49,19 @@ use Automattic\WooCommerce\Enums\ProductTaxStatus;
<span class="show_if_simple show_if_external">
<?php endif; ?>
<?php
+ $tax_label = '';
+ if ( wc_tax_enabled() ) {
+ $tax_text = wc_prices_include_tax()
+ ? __( 'incl. tax', 'woocommerce' )
+ : __( 'ex. tax', 'woocommerce' );
+ $tax_label = ' (' . $tax_text . ')';
+ }
+
woocommerce_wp_text_input(
array(
'id' => '_regular_price',
'value' => $product_object->get_regular_price( 'edit' ),
- 'label' => __( 'Regular price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')',
+ 'label' => __( 'Regular price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')' . $tax_label,
'data_type' => 'price',
)
);
@@ -63,7 +71,7 @@ use Automattic\WooCommerce\Enums\ProductTaxStatus;
'id' => '_sale_price',
'value' => $product_object->get_sale_price( 'edit' ),
'data_type' => 'price',
- 'label' => __( 'Sale price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')',
+ 'label' => __( 'Sale price', 'woocommerce' ) . ' (' . get_woocommerce_currency_symbol() . ')' . $tax_label,
'description' => '<a href="#" class="sale_schedule">' . __( 'Schedule', 'woocommerce' ) . '</a>',
)
);
diff --git a/plugins/woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php b/plugins/woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php
index 27269ddb5b0..d0ded7453fd 100644
--- a/plugins/woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php
+++ b/plugins/woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php
@@ -136,10 +136,20 @@ defined( 'ABSPATH' ) || exit;
<div class="variable_pricing">
<?php
+
+ $tax_label = '';
+ if ( wc_tax_enabled() ) {
+ $tax_text = wc_prices_include_tax()
+ ? __( 'incl. tax', 'woocommerce' )
+ : __( 'ex. tax', 'woocommerce' );
+ $tax_label = ' (' . $tax_text . ')';
+ }
+
$label = sprintf(
- /* translators: %s: currency symbol */
- __( 'Regular price (%s)', 'woocommerce' ),
- get_woocommerce_currency_symbol()
+ /* translators: 1: currency symbol, 2: tax label (prefixed with space if present) */
+ __( 'Regular price (%1$s%2$s)', 'woocommerce' ),
+ get_woocommerce_currency_symbol(),
+ $tax_label ? ' ' . $tax_label : ''
);
woocommerce_wp_text_input(
@@ -155,9 +165,10 @@ defined( 'ABSPATH' ) || exit;
);
$label = sprintf(
- /* translators: %s: currency symbol */
- __( 'Sale price (%s)', 'woocommerce' ),
- get_woocommerce_currency_symbol()
+ /* translators: 1: currency symbol, 2: tax label (prefixed with space if present) */
+ __( 'Sale price (%1$s%2$s)', 'woocommerce' ),
+ get_woocommerce_currency_symbol(),
+ $tax_label ? ' ' . $tax_label : ''
);
woocommerce_wp_text_input(