SureCart_Cron_Job.php
1 year ago
SureCart_Order.php
1 year ago
SureCart_Store.php
1 year ago
WooCommerce_Order.php
1 year ago
WooCommerce_Referrer_Meta_Box.php
1 year ago
WooCommerce_Status_Manager.php
1 year ago
SureCart_Store.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP\Ecommerce; |
| 4 | |
| 5 | /** @internal */ |
| 6 | class SureCart_Store |
| 7 | { |
| 8 | public static function cache_currency_code() : void |
| 9 | { |
| 10 | if (\class_exists('\\SureCart\\Models\\Account')) { |
| 11 | try { |
| 12 | $account = \SureCart\Models\Account::find(); |
| 13 | \update_option('iawp_surecart_currency_code', $account->currency); |
| 14 | } catch (\Throwable $e) { |
| 15 | \update_option('iawp_surecart_currency_code', 'usd'); |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | public static function get_currency_code() : string |
| 20 | { |
| 21 | $currency_code = \get_option('iawp_surecart_currency_code', 'usd'); |
| 22 | if (!\class_exists('\\SureCart\\Support\\Currency')) { |
| 23 | return 'usd'; |
| 24 | } |
| 25 | if (!\array_key_exists($currency_code, \SureCart\Support\Currency::getSupportedCurrencies())) { |
| 26 | $currency_code = 'usd'; |
| 27 | } |
| 28 | return $currency_code; |
| 29 | } |
| 30 | } |
| 31 |