Filter uncanny-automator

automator_woocommerce_order_summary_text_color

Filters the text color used in the WooCommerce order summary to allow for customization.

add_filter( 'automator_woocommerce_order_summary_text_color', $callback, 10, 1 );

Description

Filters the text color of the order summary in WooCommerce. Developers can use this hook to dynamically change the text color based on order details or other conditions, allowing for customizable order display. Defaults to black ('#000').


Usage

add_filter( 'automator_woocommerce_order_summary_text_color', 'your_function_name', 10, 1 );

Parameters

$order (mixed)
This parameter is the default color value, represented as a hexadecimal string, that will be used if no other color is specified.

Return Value

The filtered value.


Examples

<?php
/**
 * Example: Change the order summary text color to a dark blue for orders over $100.
 *
 * @param string $color The current color value.
 * @param WC_Order $order The WooCommerce order object.
 * @return string The modified color value.
 */
add_filter( 'automator_woocommerce_order_summary_text_color', function( $color, $order ) {
    // Check if the order object is valid and if its total is greater than 100.
    if ( $order instanceof WC_Order && $order->get_total() > 100 ) {
        // Change the text color to a dark blue for orders over $100.
        return '#000080'; // Dark Blue
    }

    // Return the original color if the condition is not met.
    return $color;
}, 10, 2 );

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:997
src/integrations/wholesale-suite/tokens/wss-tokens.php:638
uncanny-automator-pro/src/integrations/woocommerce/tokens/wc-pro-tokens.php:2924

* }, 10, 2 );
	 *
	 * @param $order
	 *
	 * @return string
	 */
	public function build_summary_style_html( $order ) {
		$font_colour      = apply_filters( 'automator_woocommerce_order_summary_text_color', '#000', $order );
		$font_family      = apply_filters( 'automator_woocommerce_order_summary_font_family', "'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif", $order );
		$table_styles     = apply_filters( 'automator_woocommerce_order_summary_table_style', '', $order );
		$border_colour    = apply_filters( 'automator_woocommerce_order_summary_border_color', '#eee', $order );
		$tr_border_colour = apply_filters( 'automator_woocommerce_order_summary_tr_border_color', '#e5e5e5', $order );
		$tr_text_colour   = apply_filters( 'automator_woocommerce_order_summary_tr_text_color', '#636363', $order );
		$td_border_colour = apply_filters( 'automator_woocommerce_order_summary_td_border_color', '#e5e5e5', $order );
		$td_text_colour   = apply_filters( 'automator_woocommerce_order_summary_td_text_color', '#636363', $order );


Scroll to Top