public function getAllowedShippingCountries()
    {
        $allowedShippingCountriesRaw = $this->getAllowedShippingCountriesRaw();
        $allowedShippingCountries    = [];

        foreach ($allowedShippingCountriesRaw as $countryCode => $states) {
            $states = empty($states) ? ['All' => true] : $states;
            $states = array_filter(
                array_keys($states),
                function ($st) {
                    return is_string($st) ? $st : 'All';
                }
            );

            $states = in_array('All', $states, true) ? ['All'] : $states;

            array_walk(
                $states,
                function (&$state, $key, $country) {
                    $state = $state === 'All' ? $state : $country . '-' . $state;
                },
                $countryCode
            );

            $allowedShippingCountries[] =
                [
                    'country' => $countryCode,
                    'state'   => $states
                ];
        }

        return $allowedShippingCountries;
    }
public function getAllowedShippingCountries()
    {
        $allowedShippingCountriesRaw = $this->getAllowedShippingCountriesRaw();
        $allowedShippingCountries    = [];

        foreach ($allowedShippingCountriesRaw as $countryCode => $states) {
            $states = empty($states) ? ['All' => true] : $states;
            $states = array_filter(
                array_keys($states),
                function ($st) {
                    return is_string($st) ? $st : 'All';
                }
            );

            $states = in_array('All', $states, true) ? ['All'] : $states;

            array_walk(
                $states,
                function (&$state, $key, $country) {
                    $state = $state === 'All' ? $state : $country . '-' . $state;
                },
                $countryCode
            );

            $allowedShippingCountries[] =
                [
                    'country' => $countryCode,
                    'state'   => $states
                ];
        }

        return $allowedShippingCountries;
    }
public function getAllowedShippingCountries ( ) { $ allowedShippingCountriesRaw = $ this -> getAllowedShippingCountriesRaw ( ) ; $ allowedShippingCountries = [ ] ; foreach ( $ allowedShippingCountriesRaw as $ countryCode => $ states ) { $ states = empty ( $ states ) ? [ 'All' => true ] : $ states ; $ states = array_filter ( array_keys ( $ states ) , function ( $ st ) { return is_string ( $ st ) ? $ st : 'All' ; } ) ; $ states = in_array ( 'All' , $ states , true ) ? [ 'All' ] : $ states ; array_walk ( $ states , function ( & $ state , $ key , $ country ) { $ state = $ state === 'All' ? $ state : $ country . '-' . $ state ; } , $ countryCode ) ; $ allowedShippingCountries [ ] = [ 'country' => $ countryCode , 'state' => $ states ] ; } return $ allowedShippingCountries ; }
Returns Merchant API ready array of Country, State pairs of
allowed shipping addresses by Magento

@return array() - array(['country'=>'US', 'state'=> 'All'], ...)
Returns Merchant API ready array of Country State pairs of allowed shipping addresses by Magento