Menu supplémentaire

Achetez MemberPress dès aujourd'hui ! Commencez à être payé pour le contenu que vous créez ! Obtenir MemberPress maintenant

Ajouter le code devise à MemberPress

MemberPress supports the same currencies as online payment gateways that can be integrated with MemberPress (Rayure, PayPalet Authorize.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 Code devise option. The Currency Code option lets you choose the currency MemberPress should use on your website. This option is available under the General tab à Tableau de bord > MemberPress > Paramètres.

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 functions.php de votre thème enfant. Vous pouvez également utiliser l'option WPCode plugin. Veuillez consulter le document suivant pour obtenir des instructions pas à pas sur la façon de procéder. Comment ajouter des extraits de code personnalisés dans 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) et Indian Rupee (INR), the above-mentioned line of code would look like this:

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

Note: 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.

Cet article a-t-il été utile ?

Articles connexes

fille de l'ordinateur

Achetez MemberPress dès aujourd'hui !

Commencez à être payé pour le contenu que vous créez.