问问题
1054 次
1 回答
1
As you can see you can use the woocommerce_cart_totals_order_total_html
filter hook located in that wc-cart-functions.php
core code, to alter the output of grand cart total:
add_filter( 'woocommerce_cart_totals_order_total_html', 'custom_cart_totals_order_total_html', 10, 1 );
function custom_cart_totals_order_total_html( $value ) {
// Get the fee cart amount
$fees_total = WC()->cart->fee_total;
// HERE is the condition
if( ! empty($fees_total) && $fees_total != 0 ){
// Change/customize HERE $value (just for test)
$value .= " <small>($fees_total)<small>";
}
// Always return $value
return $value;
}
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested and works.
Never overide core files, as this is something prohibited, dangerous and not convenient for many reasons
You will need to customize the code in the condition for $value
于 2017-09-05T18:52:15.050 回答