Show only allowed countries in options for customer country segment

[MAILPOET-3226]
This commit is contained in:
Rostislav Wolny
2021-05-10 12:35:10 +02:00
committed by Veljko V
parent a3935d3e04
commit 0a0c63cd1f
2 changed files with 3 additions and 3 deletions

View File

@ -90,7 +90,7 @@ class Segments {
$data['products'] = $this->wpPostListLoader->getProducts(); $data['products'] = $this->wpPostListLoader->getProducts();
$data['subscription_products'] = $this->wpPostListLoader->getSubscriptionProducts(); $data['subscription_products'] = $this->wpPostListLoader->getSubscriptionProducts();
$data['is_woocommerce_active'] = $this->woocommerceHelper->isWooCommerceActive(); $data['is_woocommerce_active'] = $this->woocommerceHelper->isWooCommerceActive();
$wcCountries = $this->woocommerceHelper->isWooCommerceActive() ? $this->woocommerceHelper->getCountries() : []; $wcCountries = $this->woocommerceHelper->isWooCommerceActive() ? $this->woocommerceHelper->getAllowedCountries() : [];
$data['woocommerce_countries'] = array_map(function ($code, $name) { $data['woocommerce_countries'] = array_map(function ($code, $name) {
return [ return [
'name' => $name, 'name' => $name,

View File

@ -65,7 +65,7 @@ class Helper {
return html_entity_decode(strip_tags($htmlPrice)); return html_entity_decode(strip_tags($htmlPrice));
} }
public function getCountries(): array { public function getAllowedCountries(): array {
return (new \WC_Countries)->get_countries() ?? []; return (new \WC_Countries)->get_allowed_countries() ?? [];
} }
} }