UPDATE: WooCommerce Cart Module Shows Currency as $ instead of £ when empty

Hi, I’ve already posted about this in December 2019 and have tried to sort out why the WooCommerce cart module shows currency as $ instead of £ when empty, but whatever I’ve tried doesn’t work! I created a staging area and turned off all plugins but the $ is still showing when the cart is empty! If there isn’t anything that can resolve this, is it an option for the cart price $0.00 to be hidden when empty (the icon and text ‘CART’ is to stay) and then show when something is added to the basket, as the £ appears when the cart has something in it!

The URL is: https://www.myhomeware.co.uk/

Thanks!

Hello @core365,

Thanks for updating in!

I have inspected your page and the source code displays the Pound sign.

It seems that there is something that changes the pound sign into a dollar sign. May we have the permission to test for a plugin conflict? We need to temporarily disable all plugins and activate them one by one to find out which one is causing this issue.

Kindly let us know.

Hi, yep no problem, thanks! I’ll give you access to the staging area as the site is live - I’ll put it in a secure note. I turned off all plugins apart from WooCommerce and your theme, but it was still showing a $ sign. I hope you have better luck than me at finding out the problem!

Thanks!

Hey @core365,

This is just a result of caching. When logged out just like what Ruenel saw, the currency is using Pound. Even when logged in, it’s also evident that’s this is an internal caching issue as viewing a product page still shows an empty cart with the Pound currency.

It’s only the home page that shows the $0.00. But, logging in and out of your site made the Pound symbol show in the home page for me. Please try it out.

If that doesn’t help, try temporarily changing the currency separators to update the view.

Hope that helps.

Hi @christian_y,

Thank you so much for looking into this. It’s so weird why it’s doing that! I changed the currency separators as you suggested and like you said, the £ symbol was then showing as it should on the Home page! I’ve activated all the plugins again and the £ is still showing as it should.

However, when I go to the actual site that’s live and do the same with the currency separators on there, it flashes up correctly for a second and then goes back to showing $0.00 in black rather than £0.00 in red. I don’t know what’s going on with it. I don’t understand how it’s now showing correctly on the staging site, but not the actual one!

Thanks!

Hi @core365,

I’ve tested this on my dev site as well, but I could not replicate it.

If its not a plugin conflict or caching, then maybe its something on your child theme. The issue is not happening on your staging site, which the child theme is not active, while your live site has an active child theme. Try switching the live site to the parent Pro theme and see if that resolves the issue. (Remember to clear cache after switching)

If the issue persists, please provide us login credentials of the live site so we can take a closer look.

Thanks,

Hi, yes you’re right, it’s the child theme that seems to be conflicting with it - I turned the child theme on in the staging area version and the $ appeared! I guess it means I can’t use the child theme for this?

Many thanks for getting to the bottom of what was going on with this, as it was getting really frustrating as I didn’t have a clue!

Thanks!

Hello @core365,

The issue is not the child theme. It is the PHP code that you added in the child theme.
You are using this:

add_filter('woocommerce_add_to_cart_fragments', 'mb_cart_count_fragments', 10, 1);

function mb_cart_count_fragments($fragments) {

	$count = WC()->cart->get_cart_contents_count();

	$value = ($count == 0) ? '$0.00' : WC()->cart->get_cart_total();

	$cart = ($count == 0) ? 'Cart' : 'Items: ' . $count;

	$fragments['.cartdropdown .x-anchor-text-secondary'] = '<span class="x-anchor-text-secondary">' . $value . '</span>';

	$fragments['.cartdropdown .x-anchor-text-primary'] = '<span class="x-anchor-text-primary">' . $cart . '</span>';



	return $fragments;



}

Please temporarily remove this PHP code block and test your site again.

Hi @RueNel,

You’ve got it spot on! The problem with this site was I just redesigned it all and that was left in from the previous site which I didn’t do! I didn’t think to check the PHP code at all.

Many thanks for your perseverance and all the time you’ve spent on this, it’s much appreciated!

Thank you!

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.