MainWP Community

Display text after cart and checkout total for specific countries in WooCommerce

Display text after cart and checkout totals for specific countries in WooCommerce on your child site.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'woocommerce_cart_totals_order_total_html', 'custom_total_message_html', 10, 1 );
function custom_total_message_html( $value ) {
    if( in_array( WC()->customer->get_shipping_country(), array('US', 'CA') ) ) {
        $value .= '<small>' . __('My text.', 'woocommerce') . '</small>';
    }
    return $value;
}
1 Like