Filter
uncanny-automator
automator_woocommerce_order_summary_subtotal_title
Filters the title displayed for the order subtotal in the WooCommerce order summary.
add_filter( 'automator_woocommerce_order_summary_subtotal_title', $callback, 10, 1 );
Description
Filters the text displayed for the order subtotal title in the WooCommerce order summary. Developers can modify this title for custom display or localization. This hook fires when the order summary is being generated.
Usage
add_filter( 'automator_woocommerce_order_summary_subtotal_title', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example: Change the 'Subtotal:' text in the WooCommerce order summary.
*
* This filter allows you to modify the title displayed for the subtotal
* in the order summary, for example, to add a custom prefix or suffix.
*
* @param string $subtotal_title The original subtotal title string.
* @return string The modified subtotal title string.
*/
add_filter( 'automator_woocommerce_order_summary_subtotal_title', 'my_custom_automator_subtotal_title', 10, 1 );
function my_custom_automator_subtotal_title( $subtotal_title ) {
// Add a custom prefix to the subtotal title.
return 'My Custom ' . $subtotal_title;
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/integrations/woocommerce/tokens/wc-tokens.php:1083
src/integrations/wholesale-suite/tokens/wss-tokens.php:710
uncanny-automator-pro/src/integrations/woocommerce/tokens/wc-pro-tokens.php:2996
$td_text_colour,
$td_border_colour
);
// Subtotal
if ( true === apply_filters( 'automator_woocommerce_order_summary_show_subtotal', true, $order ) ) {
$html[] = '<tr>';
$html[] = $td;
$html[] = apply_filters( 'automator_woocommerce_order_summary_subtotal_title', esc_attr__( 'Subtotal:', 'uncanny-automator' ) );
$html[] = '</td>';
$html[] = $td_right;
$html[] = $order->get_subtotal_to_display();
$html[] = '</td>';
$html[] = '</tr>';
}
// Tax