Registering Currency Codes

By default, Restrict Content Pro supports most major currencies. If your currency is not supported, however, it can be registered through a small PHP code snippet.

Use the rcp_currencies filter to add the new currency:

function pw_rcp_custom_currency( $currencies ) {
	$currencies['MRO'] = 'Ouguiya';
	return $currencies;
add_filter( 'rcp_currencies', 'pw_rcp_custom_currency' );

This adds the currency to the dropdown in Restrict > Settings > Payments. This is the only necessary step to get your currency operational.

The second, optional step is to add the currency symbol before or after the price. If you skip this step, then the currency code is appended/prepended by default.

Adding the currency symbol is done with either the rcp_{currency code}_currency_filter_before filter (to show the symbol before the price), or the rcp_{currency code}_currency_filter_after filter (to show the currency symbol after). Which filter is used depends on your "Currency Position" settings in Restrict > Settings > Payments.

Here's an example for adding the currency symbol after the price:

function ag_rcp_mro_currency_filter_after( $formatted_price, $currency_code, $price ) {
    return $price . ' ' . 'UM';

add_filter( 'rcp_mro_currency_filter_after', 'ag_rcp_mro_currency_filter_after', 10, 3 );

This would display the price as 10 UM. In the filter name (rcp_mro_currency_filter_after), you need to replace mro with your own currency code that you added in the first step (but all lowercase).

Place these code snippets into a custom plugin. If you're unsure of how to create a plugin, you can use  Pluginception to easily create one.