Menú adicional

¡Consiga MemberPress hoy mismo! ¡Empieza a cobrar por los contenidos que creas! Obtenga MemberPress ahora

Añadir código de moneda a MemberPress

MemberPress supports the same currencies as online payment gateways that can be integrated with MemberPress (Stripe, PayPaly Autorizar.net). You can add a currency code to the MemberPress currency list by adding a code snippet to your website.

This document provides a code snippet to add a currency code to the MemberPress currency list. It also explains how to modify the code based on your needs.

Add Currency Code To MemberPress – Code Snippet

This code snippet will add a currency to the MemberPress currency list under the Código de moneda option. The Currency Code option lets you choose the currency MemberPress should use on your website. This option is available under the General tab en Panel de control > MemberPress > Configuración.

The sample code will add the Egyptian Pound (EGP) to the currency list.

//Add Currency Codes To MemberPress

function mepr_currency_codes( $codes ) {
array_push( $codes, 'EGP' ); // Adds 'EGP' to the list of currency codes. To add a different currency, replace EGP with the three-letter currency code of the needed currency.
return $codes; // Return the modified list of currency codes.
}
add_filter( 'mepr-currency-codes', 'mepr_currency_codes' );

You can add the code snippet to your website to the funciones.php de su tema hijo. Como alternativa, puede utilizar el archivo WPCode plugin. Consulte el siguiente documento para obtener instrucciones paso a paso sobre Cómo añadir fragmentos de código personalizados en WPCode.

Modifying Code Snippet

To add a different currency, you should replace EGP with the three-letter currency code of the needed currency, on this line:

array_push( $codes, 'EGP' );

You can also add multiple currencies if needed. To do this, add the three-letter currency codes of the needed currencies, separating them with a comma.

For example, to add both Egyptian Pound (EGP) y Indian Rupee (INR), the above-mentioned line of code would look like this:

array_push( $codes, 'EGP', 'INR' )

Nota: The code snippet will add the currency code to MemberPress. However, the payment gateway you selected must also support the currency to use it for online payments.

¿Le ha resultado útil este artículo?

Artículos relacionados

chica del ordenador

¡Consiga MemberPress hoy mismo!

Empieza a cobrar por los contenidos que creas.