I was able to fix the main cart’s currency but I’m still having an issue with the cart drawer for the theme.
When adding a non-custom item to the cart the cart drawer is triggered, but it is showing the item amount in USD and not the selected currency.
function mfn_get_woo_sidecart_footer(){
//WC()->cart->calculate_totals();
$is_translatable = mfn_opts_get('translate');
$translate['translate-side-cart-shipping-free'] = $is_translatable ? mfn_opts_get('translate-side-cart-shipping-free', 'Free!') : __('Free!', 'woocommerce');
// output ---
echo '<div class="mfn-chft-row mfn-chft-subtotal">'.__( 'Subtotal', 'woocommerce' ).': '; wc_cart_totals_subtotal_html(); echo '</div>';
if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) :
$total = esc_html($translate['translate-side-cart-shipping-free']);
if ( 0 < WC()->cart->get_shipping_total() ) {
if ( WC()->cart->display_prices_including_tax() ) {
$total = wc_price( WC()->cart->shipping_total + WC()->cart->shipping_tax_total );
if ( WC()->cart->shipping_tax_total > 0 && ! wc_prices_include_tax() ) {
$total .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
}
} else {
$total = wc_price( WC()->cart->shipping_total );
if ( WC()->cart->shipping_tax_total > 0 && wc_prices_include_tax() ) {
$total .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
}
}
}
echo '<div class="mfn-chft-row mfn-chft-row-shipping">'.__( 'Shipping', 'woocommerce' ).': <span>'. $total .'</span></div>';
endif;
echo '<div class="mfn-chft-row mfn-chft-total">'.__( 'Total', 'woocommerce' ).': '; wc_cart_totals_subtotal_html(); echo '</div>';
}
This seems to be the code controlling the shipping, subtotal and total. I changed the last line to fix an issue that was occurring in which the total was being calculated in USD. I’m not sure if this is a yaycurrency or theme related issue.
We have a custom product that is generated by a custom plugin we made. When this custom product is finished generating in the custom backend it adds the item to cart and redirects to the /cart page.
When a user adds a non-custom product then they are not redirected and instead the drawer opens and shows the items added, but in USD and not the selected currency. Upon refresh the correct data is shown for the totals.