Filter
uncanny-automator
automator_woocommerce_order_summary_price_title
Filters the title displayed for the price in the WooCommerce order summary.
add_filter( 'automator_woocommerce_order_summary_price_title', $callback, 10, 1 );
Description
Filters the title displayed for the price column in WooCommerce order summaries. Developers can use this hook to customize the text, such as changing "Price" to something else or adding dynamic content. The filter is applied directly before the price is rendered.
Usage
add_filter( 'automator_woocommerce_order_summary_price_title', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
/**
* Example of how to filter the 'automator_woocommerce_order_summary_price_title' hook.
* This example changes the default "Price" title to "Item Cost" for the order summary.
*
* @param string $title The original title of the price column.
* @return string The modified title.
*/
add_filter( 'automator_woocommerce_order_summary_price_title', function ( $title ) {
// Check if the title is the default "Price" before modifying it.
if ( esc_attr__( 'Price', 'uncanny-automator' ) === $title ) {
return esc_attr__( 'Item Cost', 'uncanny-automator' );
}
return $title;
}, 10, 1 );
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:1038
src/integrations/wholesale-suite/tokens/wss-tokens.php:665
uncanny-automator-pro/src/integrations/woocommerce/tokens/wc-pro-tokens.php:2951
$th = sprintf(
'<th class="td" scope="col" style="color: %s; border: 1px solid %s; vertical-align: middle; padding: 12px; text-align: left;">',
$tr_text_colour,
$tr_border_colour
);
$html[] = $th . '<strong>' . apply_filters( 'automator_woocommerce_order_summary_product_title', esc_attr__( 'Product', 'uncanny-automator' ) ) . '</strong></th>';
$html[] = $th . '<strong>' . apply_filters( 'automator_woocommerce_order_summary_quantity_title', esc_attr__( 'Quantity', 'uncanny-automator' ) ) . '</strong></th>';
$html[] = $th . '<strong>' . apply_filters( 'automator_woocommerce_order_summary_price_title', esc_attr__( 'Price', 'uncanny-automator' ) ) . '</strong></th>';
$html[] = '</thead>';
if ( $items ) {
/** @var WC_Order_Item_Product $item */
$td = sprintf(
'<td class="td" style="color: %s; border: 1px solid %s; padding: 12px; text-align: left; vertical-align: middle; font-family: %s">',
$td_text_colour,
$td_border_colour,