Skip to content

Instantly share code, notes, and snippets.

@dancameron
Created August 30, 2019 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dancameron/3e48d0a5a206d343136909178b981a42 to your computer and use it in GitHub Desktop.
Save dancameron/3e48d0a5a206d343136909178b981a42 to your computer and use it in GitHub Desktop.
Add Currency Code to Invoice Money Formatting
<?php // don't include this line in your functions.php, since it already starts with it.
function _round_sa_formatted_money( $money, $orig_amount, $doc_id ) {
$doc = si_get_doc_object( $doc_id );
if ( '' == $doc ) {
return $money;
}
$client = $doc->get_client();
if ( ! is_a( $client, 'SI_Client' ) ) {
return $money;
}
$client_currency = $client->get_currency();
if ( '' == $client_currency ) {
$client_currency = 'USD'; // this would be the default if the client doesn't have one set.
}
return $money . ' ' . $client_currency;
}
add_filter( 'sa_get_formatted_money', '_round_sa_formatted_money', 10, 3 );
@dancameron
Copy link
Author

This snippet is a customization for Sprout Invoices. A customizable solution that provides a way for you to get paid via your WordPress site. For more information please don't hesitate to reach out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment