Skip to content

Instantly share code, notes, and snippets.

@NickGreen
Last active February 8, 2021 19:48
Show Gist options
  • Save NickGreen/63d1fb95e7b3f3d47d2decb68169bf08 to your computer and use it in GitHub Desktop.
Save NickGreen/63d1fb95e7b3f3d47d2decb68169bf08 to your computer and use it in GitHub Desktop.
Switch currency position to left for USD
<?php
add_filter('woocommerce_price_format', 'woo_custom_format_position', 999, 2);
function woo_custom_format_position( $format, $currency_pos )
{
/*'left':$format = '%1$s%2$s';
'right':$format = '%2$s%1$s';
'left_space':$format = '%1$s&nbsp;%2$s';
'right_space':$format = '%2$s&nbsp;%1$s';
*/
IF_CURRENCY_IS_USD {
$format = '%1$s%2$s';//Change your position
}
return $format;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment