-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathCheckoutHelper.php
More file actions
52 lines (43 loc) · 1.13 KB
/
CheckoutHelper.php
File metadata and controls
52 lines (43 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace SkyVerge\WooCommerce\PluginFramework\v6_0_2\Helpers;
class CheckoutHelper
{
/**
* Determines whether the provided country code is allowed to place an order.
*
* @since 6.0.1
*
* @param string $countryCode recommended to pass through the *billing* address
* @return bool
*/
public static function isCountryAllowedToOrder(string $countryCode): bool
{
if (empty($countryCode)) {
return false;
}
if (WC() && WC()->countries) {
$allowed_countries = WC()->countries->get_allowed_countries();
return array_key_exists($countryCode, $allowed_countries);
}
return true;
}
/**
* Determines whether the provided country code is allowed for shipping.
*
* @since 6.0.1
*
* @param string $countryCode recommended to pass through the *shipping* address
* @return bool
*/
public static function isCountryAllowedForShipping(string $countryCode): bool
{
if (empty($countryCode)) {
return false;
}
if (WC() && WC()->countries) {
$shipping_countries = WC()->countries->get_shipping_countries();
return array_key_exists($countryCode, $shipping_countries);
}
return true;
}
}