Rynald0s
(@rynald0s)
Automattic Happiness Engineer
Hi @jessamca11!
Try the following:
function rs_custom_currency_symbols( $currency_symbol, $currency ) {
switch( $currency ) {
case 'CAD':
$currency_symbol = '$ CAD ';
}
return $currency_symbol;
}
add_filter('woocommerce_currency_symbol', 'rs_custom_currency_symbols', 30, 2);
Cheers!
thank you! this works great.
however it says $ CAD 22
How would I make it say $22 CAD instead?
thanks
Hi @jessamca11,
Thanks for getting back.
Another approach would be to add CAD after the price using CSS. You could try adding this to your Customizer → Additional CSS box:
bdi:after {
content: " CAD";
}
Thanks.
Hi,
We’ve not heard back from you in a while, so I’m marking this thread as resolved.
Just to mention, you could adapt your earlier solution further to show CAD price suffix on your cart and checkout pages by also targeting the following:
* woocommerce_cart_item_price
* woocommerce_cart_item_subtotal
* woocommerce_cart_subtotal
* woocommerce_cart_total
So, something like this should work:
add_filter( 'woocommerce_get_price_html', 'bbloomer_add_price_prefix', 99, 2 );
add_filter( 'woocommerce_cart_item_price', 'bbloomer_add_price_prefix' );
add_filter( 'woocommerce_cart_item_subtotal', 'bbloomer_add_price_prefix' );
add_filter( 'woocommerce_cart_subtotal', 'bbloomer_add_price_prefix' );
add_filter( 'woocommerce_cart_total', 'bbloomer_add_price_prefix' );
function bbloomer_add_price_prefix( $price, $product ){
$price = 'CAD' . $price;
return $price;
}
Hopefully, all the above suggestions were helpful!
If you have further questions, please feel free to open a new topic.
Thanks.