Automattic\WooCommerce\Internal\Admin\Suggestions
PaymentExtensionSuggestions::is_extension_allowed()
Determine if a payment extension is allowed to be suggested.
Метод класса: PaymentExtensionSuggestions{}
Хуков нет.
Возвращает
true|false
. True if the extension is allowed, false otherwise.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_extension_allowed( $extension_id, $country_code, $context ): bool;
- $extension_id(строка) (обязательный)
- The extension ID.
- $country_code(строка) (обязательный)
- The two-letter country code.
- $context(строка)
- The context ID of where the extension is being used.
По умолчанию: ''
Код PaymentExtensionSuggestions::is_extension_allowed() PaymentExtensionSuggestions::is extension allowed 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; }