Skip to content

Instantly share code, notes, and snippets.

@lelandf
Last active October 12, 2022 17:01
Show Gist options
  • Save lelandf/281c54e7c4e79caf2796e0f148c86923 to your computer and use it in GitHub Desktop.
Save lelandf/281c54e7c4e79caf2796e0f148c86923 to your computer and use it in GitHub Desktop.
[RCP] Example of space between currency and price
<?php
// Both of these examples are specific to Swiss Franc, hence the "chf" in the filter name
// Replace with different currency accordingly
// This is if currency position is set to "before"
add_filter( 'rcp_chf_currency_filter_before', function( $formatted, $currency, $price ) {
$formatted = $currency . ' ' . rcp_format_amount( $price );
return $formatted;
}, 10, 3 );
// This is if currency position is set to "after"
add_filter( 'rcp_chf_currency_filter_after', function( $formatted, $currency, $price ) {
$formatted = rcp_format_amount( $price ) . ' ' . $currency;
return $formatted;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment