Automattic\WooCommerce\Internal\Admin\Suggestions

PaymentExtensionSuggestions::is_extension_allowed()privateWC 1.0

Determine if a payment extension is allowed to be suggested.

Method of the class: PaymentExtensionSuggestions{}

No Hooks.

Return

true|false. True if the extension is allowed, false otherwise.

Usage

// private - for code of main (parent) class only
$result = $this->is_extension_allowed( $extension_id, $country_code, $context ): bool;
$extension_id(string) (required)
The extension ID.
$country_code(string) (required)
The two-letter country code.
$context(string)
The context ID of where the extension is being used.
Default: ''

PaymentExtensionSuggestions::is_extension_allowed() code WC 9.6.1

private function is_extension_allowed( string $extension_id, string $country_code, string $context = '' ): bool { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed

	/*
	 * For now, we only need to run logic for the Square In-Person extension.
	 * If more extensions need to be filtered out, we can add more logic here until we decide to abstract it.
	 */

	if ( self::SQUARE_IN_PERSON === $extension_id ) {
		// Square (In-Person) is only allowed if the merchant is selling offline.
		return $this->is_merchant_selling_offline();
	}

	return true;
}