Automattic\WooCommerce\Internal\Admin\Settings\PaymentsProviders
PaymentGateway::validate_recommended_payment_method
Validate a recommended payment method entry.
Method of the class: PaymentGateway{}
No Hooks.
Returns
true|false. True if the recommended payment method entry is valid, false otherwise.
Usage
// protected - for code of main (parent) or child class $result = $this->validate_recommended_payment_method( $recommended_pm ): bool;
- $recommended_pm(mixed) (required)
- The recommended payment method entry to validate.
PaymentGateway::validate_recommended_payment_method() PaymentGateway::validate recommended payment method code WC 10.6.2
protected function validate_recommended_payment_method( $recommended_pm ): bool {
// We require at least `id` and `title`.
return is_array( $recommended_pm ) &&
! empty( $recommended_pm['id'] ) &&
! empty( $recommended_pm['title'] );
}