
replace the ugly "echo"-es with beans_xxxx_markup_e
function cw_discount() {
global $woocommerce;
$cw_discount = 0;
foreach ( $woocommerce->cart->get_cart() as $cw_cart_key => $values) {
$_product = $values['data'];
if ( $_product->is_on_sale() ) {
$regular_price = $_product->get_regular_price();
$sale_price = $_product->get_sale_price();
$discount = ($regular_price - $sale_price) * $values['quantity'];
$cw_discount += $discount;
}
}
if ( $cw_discount > 0 ) {
beans_open_markup_e('discount_table_tr_1', 'tr', array( 'class' => 'cart-discount' ) );
beans_open_markup_e( 'discount_table_th_1', 'th');
_e( 'Secure', 'woocommerce' );
beans_close_markup_e( 'discount_table_th_1', 'th');
beans_open_markup_e( 'discount_table_td_1', 'td', array( 'data-title' => _e('Secure') ) );
wc_price( $cw_discount + $woocommerce->cart->discount_cart );
beans_close_markup_e( 'discount_table_td_1', 'td');
beans_close_markup_e('discount_table_tr_1', 'tr');
}
}
add_action( 'woocommerce_cart_totals_after_order_total', 'cw_discount');
add_action( 'woocommerce_review_order_after_order_total', 'cw_discount');
CODE IS UNTESTED!