mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add support for multiple currencies and countries
This commit is contained in:
parent
83cb9d607a
commit
98536361af
2 changed files with 16 additions and 14 deletions
|
@ -27,33 +27,33 @@ return array(
|
||||||
return array(
|
return array(
|
||||||
'bancontact' => array(
|
'bancontact' => array(
|
||||||
'id' => BancontactGateway::ID,
|
'id' => BancontactGateway::ID,
|
||||||
'country' => 'BE',
|
'countries' => array('BE'),
|
||||||
'currency' => 'EUR',
|
'currencies' => array('EUR'),
|
||||||
),
|
),
|
||||||
'blik' => array(
|
'blik' => array(
|
||||||
'id' => BlikGateway::ID,
|
'id' => BlikGateway::ID,
|
||||||
'country' => 'PL',
|
'countries' => array('PL'),
|
||||||
'currency' => 'PLN',
|
'currencies' => array('PLN'),
|
||||||
),
|
),
|
||||||
'eps' => array(
|
'eps' => array(
|
||||||
'id' => EPSGateway::ID,
|
'id' => EPSGateway::ID,
|
||||||
'country' => 'AT',
|
'countries' => array('AT'),
|
||||||
'currency' => 'EUR',
|
'currencies' => array('EUR'),
|
||||||
),
|
),
|
||||||
'ideal' => array(
|
'ideal' => array(
|
||||||
'id' => IDealGateway::ID,
|
'id' => IDealGateway::ID,
|
||||||
'country' => 'NL',
|
'countries' => array('NL'),
|
||||||
'currency' => 'EUR',
|
'currencies' => array('EUR'),
|
||||||
),
|
),
|
||||||
'mybank' => array(
|
'mybank' => array(
|
||||||
'id' => MyBankGateway::ID,
|
'id' => MyBankGateway::ID,
|
||||||
'country' => 'IT',
|
'countries' => array('IT'),
|
||||||
'currency' => 'EUR',
|
'currencies' => array('EUR'),
|
||||||
),
|
),
|
||||||
'p24' => array(
|
'p24' => array(
|
||||||
'id' => P24Gateway::ID,
|
'id' => P24Gateway::ID,
|
||||||
'country' => 'PL',
|
'countries' => array('PL'),
|
||||||
'currency' => 'EUR',
|
'currencies' => array('EUR', 'PLN'),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -74,7 +74,10 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
|
||||||
|
|
||||||
$payment_methods = $c->get('ppcp-local-apms.payment-methods');
|
$payment_methods = $c->get('ppcp-local-apms.payment-methods');
|
||||||
foreach ($payment_methods as $payment_method) {
|
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'] ] );
|
unset( $methods[ $payment_method['id'] ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +94,6 @@ class LocalAlternativePaymentMethodsModule implements ModuleInterface {
|
||||||
foreach ($payment_methods as $key => $value) {
|
foreach ($payment_methods as $key => $value) {
|
||||||
$payment_method_registry->register( $c->get( 'ppcp-local-apms.' . $key . '.payment-method' ) );
|
$payment_method_registry->register( $c->get( 'ppcp-local-apms.' . $key . '.payment-method' ) );
|
||||||
}
|
}
|
||||||
$a = 1;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue