Last active
July 15, 2021 05:15
-
-
Save seb86/f17abf31fc1b4ab2aee921174f357d6b to your computer and use it in GitHub Desktop.
Return totals in cart response formatted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cocart_cart', 'cocart_totals_html' ); | |
function cocart_totals_html( $cart ) { | |
$decimals = wc_get_price_decimals(); | |
foreach( $cart['totals'] as $total => $value ) { | |
$value = substr_replace( $value, '', intval( '-' . $decimals ) ); | |
$cart['totals'][$total] = html_entity_decode( strip_tags( wc_price( $value ) ) ); | |
} | |
return $cart; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment