You are here

public function StoreCountryResolver::resolve in Commerce Core 8.2

Resolves the country.

Return value

\Drupal\commerce\Country|null The country object, if resolved. Otherwise NULL, indicating that the next resolver in the chain should be called.

Overrides CountryResolverInterface::resolve

File

modules/store/src/Resolver/StoreCountryResolver.php, line 42

Class

StoreCountryResolver
Returns the store's billing country.

Namespace

Drupal\commerce_store\Resolver

Code

public function resolve() {
  $store = $this->currentStore
    ->getStore();
  $address = $store ? $store
    ->getAddress() : NULL;
  if ($address) {
    return new Country($address
      ->getCountryCode());
  }
}