mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
Merge pull request #427 from woocommerce/pcp-467-currency
Do not use get_woocommerce_currency
This commit is contained in:
commit
0b97b1a69f
2 changed files with 7 additions and 2 deletions
|
@ -322,7 +322,13 @@ return array(
|
||||||
},
|
},
|
||||||
|
|
||||||
'api.shop.currency' => static function ( ContainerInterface $container ) : string {
|
'api.shop.currency' => static function ( ContainerInterface $container ) : string {
|
||||||
return get_woocommerce_currency();
|
// We use option instead of get_woocommerce_currency
|
||||||
|
// because it will not be overridden by currency switching plugins.
|
||||||
|
$currency = get_option( 'woocommerce_currency' );
|
||||||
|
if ( ! $currency ) {
|
||||||
|
return 'NO_CURRENCY'; // Unlikely to happen.
|
||||||
|
}
|
||||||
|
return $currency;
|
||||||
},
|
},
|
||||||
'api.shop.country' => static function ( ContainerInterface $container ) : string {
|
'api.shop.country' => static function ( ContainerInterface $container ) : string {
|
||||||
$location = wc_get_base_location();
|
$location = wc_get_base_location();
|
||||||
|
|
|
@ -26,7 +26,6 @@ class ModularTestCase extends TestCase
|
||||||
when('get_site_url')->justReturn('example.com');
|
when('get_site_url')->justReturn('example.com');
|
||||||
when('get_bloginfo')->justReturn('My Shop');
|
when('get_bloginfo')->justReturn('My Shop');
|
||||||
when('wc_get_base_location')->justReturn(['country' => 'US']);
|
when('wc_get_base_location')->justReturn(['country' => 'US']);
|
||||||
when('get_woocommerce_currency')->justReturn('USD');
|
|
||||||
when('WC')->justReturn((object) [
|
when('WC')->justReturn((object) [
|
||||||
'session' => null,
|
'session' => null,
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue