Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Payments::get_payments_settings_country │ private │ WC 1.0

Get the store's business registration country/location as it is used on the Payments Settings page.

Method of the class: Payments{}

No Hooks.

Returns

string. The business registration country/location code.

Usage

// private - for code of main (parent) class only
$result = $this->get_payments_settings_country(): string;

Payments::get_payments_settings_country() code WC 11.1.2

private function get_payments_settings_country(): string {
	try {
		/**
		 * The Payments Settings [page] service.
		 *
		 * @var SettingsPaymentsService $settings_payments_service
		 */
		$settings_payments_service = wc_get_container()->get( SettingsPaymentsService::class );

		return $settings_payments_service->get_country();
	} catch ( \Throwable $e ) {
		// In case of any error, return the WooCommerce base country.
		return WC()->countries->get_base_country();
	}
}