Add support for multiple currencies and countries

This commit is contained in:
Emili Castells Guasch 2024-08-21 15:55:36 +02:00
parent 83cb9d607a
commit 98536361af
2 changed files with 16 additions and 14 deletions

View file

@ -74,7 +74,10 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
$payment_methods = $c->get('ppcp-local-apms.payment-methods');
foreach ($payment_methods as $payment_method) {
if ( $customer_country !== $payment_method['country'] || $site_currency !== $payment_method['currency'] ) {
if (
! in_array($customer_country, $payment_method['countries'], true)
|| ! in_array($site_currency, $payment_method['currencies'], true)
) {
unset( $methods[ $payment_method['id'] ] );
}
}
@ -91,7 +94,6 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
foreach ($payment_methods as $key => $value) {
$payment_method_registry->register( $c->get( 'ppcp-local-apms.' . $key . '.payment-method' ) );
}
$a = 1;
}
);